[rhq] Branch 'bundle' - 296 commits - .classpath etc/eclipse-tools .gitignore modules/core modules/enterprise modules/plugins
by mazz
.classpath | 2
.gitignore | 2
etc/eclipse-tools/hibernate.cfg.xml | 9
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java | 88 +
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java | 13
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java | 47 +
modules/core/dbutils/pom.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup-build.xml | 2
modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml | 12
modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml | 25
modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml | 23
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 125 ++
modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java | 35
modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionCategory.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java | 190 ++--
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java | 35
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/RoleNotification.java | 129 --
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SenderResult.java | 114 ++
modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SubjectNotification.java | 129 --
modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java | 40
modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java | 31
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java | 15
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java | 142 +++
modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationRequestStatus.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java | 2
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java | 14
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java | 27
modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java | 253 +++++
modules/core/domain/src/main/java/org/rhq/core/domain/search/SearchContext.java | 38
modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java | 90 +
modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java | 4
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractConfigurationComponent.java | 10
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractPropertyBagUIComponentTreeFactory.java | 8
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigUIComponent.java | 72 -
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java | 9
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSetComponent.java | 7
modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/PropertySetRenderer.java | 2
modules/core/gui/src/main/java/org/rhq/core/gui/converter/PropertySimpleValueConverter.java | 73 -
modules/core/gui/src/main/java/org/rhq/core/gui/validator/PropertySimpleValueValidator.java | 2
modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java | 2
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java | 4
modules/core/plugin-container/pom.xml | 6
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java | 12
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java | 85 -
modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentService.java | 4
modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentServiceImpl.java | 6
modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentUtil.java | 6
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java | 256 ++++-
modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigurationManagerTest.java | 51 -
modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java | 9
modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java | 8
modules/enterprise/gui/alert-migration/src/main/java/org/rhq/helpers/alertMigration/MigrationServlet.java | 1
modules/enterprise/gui/portal-war/pom.xml | 27
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java | 296 ++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java | 325 +++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java | 28
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionNotificationStore.java | 55 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertMessages.java | 70 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationConverter.java | 57 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStore.java | 33
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStoreSelector.java | 36
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationTemplateStore.java | 68 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java | 83 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertPrioritiesUIBean.java | 48 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java | 72 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java | 34
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/DefinitionNotificationsUIBean.java | 109 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java | 22
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java | 347 +------
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java | 69 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/AlertNotificationConverter.java | 57 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricAbsoluteConverter.java | 50 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java | 58 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java | 13
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/AlertValidatorUtil.java | 45
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/EventRegexValidator.java | 48 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java | 15
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ListConfigurationUpdateUIBean.java | 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java | 84 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/FileUploadComponent.java | 103 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java | 4
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java | 81 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java | 80 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationDefinitionComponent.java | 48 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java | 269 +++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java | 332 +++++++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoResourcesUIBean.java | 20
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoSubscriptionsUIBean.java | 21
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoUnsubscriptionsUIBean.java | 21
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ListResourceGroupMembersUIBean.java | 20
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java | 37
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java | 39
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/QuickFavoritesUtil.java | 10
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/AckAlertAction.java | 78 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ReenableAlertDefinitionAction.java | 80 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java | 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesAction.java | 84 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesForm.java | 122 --
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesFormPrepareAction.java | 82 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersAction.java | 86 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersForm.java | 123 --
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersFormPrepareAction.java | 83 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionAction.java | 91 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionFormPrepareAction.java | 57 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java | 68 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/SyslogActionForm.java | 148 ---
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsRolesAction.java | 43
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsUsersAction.java | 43
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionAction.java | 61 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java | 62 +
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java | 2
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java | 103 ++
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java | 45
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util/LookupComponent.java | 127 ++
modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties | 4
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/classes/messages.properties | 3
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml | 24
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml | 6
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml | 32
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/configuration-navigation.xml | 8
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml | 60 +
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml | 61 -
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tiles/events-def.xml | 45
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml | 15
modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp | 24
modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp | 7
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp | 37
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsRoles.jsp | 11
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsUsers.jsp | 11
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp | 33
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventRoles.jsp | 44
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventUsers.jsp | 44
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AlertDefinitionActive.jsp | 10
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListRoles.jsp | 27
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListUsers.jsp | 30
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinition.jsp | 2
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionNotifications.jsp | 49 -
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp | 45
modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionBox.jsp | 13
modules/enterprise/gui/portal-war/src/main/webapp/resource/group/inventory/AddResourcesForm.jsp | 3
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml | 31
modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml | 3
modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repo.xhtml | 35
modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repoSubscriptions.xhtml | 43
modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml | 25
modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view.xhtml | 37
modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml | 6
modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml | 4
modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/layout/main.xhtml | 6
modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml | 153 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml | 41
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertDefinitions.xhtml | 32
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml | 72 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml | 456 ++++++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/newAlert.xhtml | 44
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/customContent.xhtml | 3
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml | 153 +--
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/notificationTemplates.xhtml | 190 ----
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml | 153 ++-
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/add-map.xhtml | 6
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/download.jsp | 11
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-map.xhtml | 6
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw-full.xhtml | 38
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw.xhtml | 115 --
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml | 317 +-----
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml | 41
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml | 150 +++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml | 28
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml | 99 +-
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload.xhtml | 55 -
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-map.xhtml | 4
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-full.xhtml | 38
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml | 80 +
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml | 113 --
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml | 244 -----
modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml | 87 -
modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml | 70 -
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml | 33
modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml~ | 52 +
modules/enterprise/gui/portal-war/src/test/groovy/org/rhq/enterprise/gui/util/LookupComponentTest.groovy | 92 ++
modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java | 2
modules/enterprise/server/ear/pom.xml | 59 +
modules/enterprise/server/jar/pom.xml | 47 -
modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g | 181 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java | 262 ++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java | 21
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java | 232 +----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java | 31
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java | 21
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 41
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java | 41
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java | 18
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 90 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 16
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java | 33
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerLocal.java | 18
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java | 36
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/MasterServerPluginContainer.java | 23
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSender.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java | 116 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/ResultState.java | 33
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/SenderResult.java | 117 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 191 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 18
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/RepoSyncJob.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java | 120 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerLocal.java | 31
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java | 119 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java | 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java | 6
modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt | 126 ++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java | 3
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java | 13
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java | 2
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java | 171 +++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java | 3
modules/enterprise/server/plugins/alert-email/src/main/java/org/rhq/enterprise/server/plugins/alertEmail/EmailSender.java | 12
modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java | 6
modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java | 13
modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java | 11
modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml | 3
modules/enterprise/server/plugins/alert-operations/pom.xml | 180 +++
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/AlertTokenReplacer.java | 231 +++++
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java | 305 ++++++
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java | 144 +++
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java | 90 +
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java | 129 ++
modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java | 67 +
modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml | 33
modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml | 87 +
modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl | 28
modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java | 191 ++++
modules/enterprise/server/plugins/alert-operations/tokens.xml | 137 +++
modules/enterprise/server/plugins/alert-roles/pom.xml | 7
modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java | 157 +++
modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java | 46 -
modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml | 46 -
modules/enterprise/server/plugins/alert-scriptlang/pom.xml | 3
modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java | 6
modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory | 1
modules/enterprise/server/plugins/alert-sms/README.txt | 34
modules/enterprise/server/plugins/alert-sms/pom.xml | 200 ++++
modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java | 218 ++++
modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml | 41
modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.Providers | 17
modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate | 1
modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java | 6
modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml | 2
modules/enterprise/server/plugins/alert-subject/pom.xml | 17
modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java | 150 +++
modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java | 33
modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml | 62 -
modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java | 14
modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml | 12
modules/enterprise/server/plugins/pom.xml | 7
modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml | 2
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java | 39
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryDiscoveryComponent.java | 10
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java | 176 +++
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java | 111 ++
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java | 75 +
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java | 75 +
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java | 25
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java | 85 +
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheAugeasMapping.java | 1
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheDirectiveRegExpression.java | 20
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/DirectiveMapping.java | 14
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/AugeasNodeSearch.java | 89 +
modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml | 69 +
modules/plugins/apache/src/main/resources/httpd.aug | 47 -
modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java | 3
modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/AugeasTreeBuilder.java | 22
modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java | 22
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java | 11
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java | 24
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java | 89 +
modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java | 30
modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml | 6
modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml | 6
modules/plugins/netservices/pom.xml | 18
modules/plugins/nss/pom.xml | 207 ++++
modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java | 365 ++++++++
modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java | 83 +
modules/plugins/nss/src/main/resources/META-INF/rhq-plugin.xml | 33
modules/plugins/raw-config-test/pom.xml | 4
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy | 80 +
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/RawServer.groovy | 24
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy | 73 -
modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy | 77 +
modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml | 88 +
modules/plugins/virt/src/main/java/org/rhq/plugins/virt/LibVirtConnection.java | 77 +
modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java | 1
modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkComponent.java | 2
modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkDiscoveryComponent.java | 6
304 files changed, 12859 insertions(+), 5333 deletions(-)
New commits:
commit d9d58661d22bf1698c11ea8fbb33b17ad0e38bac
Merge: b98aefb... 9092141...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 20:52:29 2010 -0500
Merge branch 'bundle-copy' into bundle
commit 90921416205a3f3ab2bdd6aa7f32142053b6ed67
Merge: ac72b22... eea8401...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 20:52:11 2010 -0500
Merge branch 'master' into bundle-copy
commit eea8401df5d7d8c508584ae266927e0286c381f1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 20:48:59 2010 -0500
fixed this test so it isn't so brittle - not sure how master has been passing since we moved to 3.0.0
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index 4c39807..f950282 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -150,6 +150,10 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <systemPropertyVariables>
+ <rhq.version>${project.version}</rhq.version>
+ </systemPropertyVariables>
+
<excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
<!-- need to point the library path to the location of the native libraries -->
<argLine>-Dorg.hyperic.sigar.path=${project.build.directory}/jboss-sigar</argLine>
@@ -180,4 +184,4 @@
</repository>
</repositories>
-</project>
\ No newline at end of file
+</project>
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
index a7d27ed..a315276 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
@@ -47,13 +47,14 @@ import java.io.File;
public class PluginManagerTest {
- static final String PLATFORM_PLUGIN = "org/rhq/rhq-platform-plugin/1.4.0-SNAPSHOT/rhq-platform-plugin-1.4.0-SNAPSHOT.jar";
+ static final String VERSION = System.getProperty("rhq.version");
+ static final String PLATFORM_PLUGIN = "org/rhq/rhq-platform-plugin/" + VERSION + "/rhq-platform-plugin-" + VERSION + ".jar";
- static final String HOSTS_PLUGIN = "org/rhq/rhq-hosts-plugin/1.4.0-SNAPSHOT/rhq-hosts-plugin-1.4.0-SNAPSHOT.jar";
+ static final String HOSTS_PLUGIN = "org/rhq/rhq-hosts-plugin/" + VERSION + "/rhq-hosts-plugin-" + VERSION + ".jar";
- static final String AUGEAS_PLUGIN = "org/rhq/rhq-augeas-plugin/1.4.0-SNAPSHOT/rhq-augeas-plugin-1.4.0-SNAPSHOT.jar";
+ static final String AUGEAS_PLUGIN = "org/rhq/rhq-augeas-plugin/" + VERSION + "/rhq-augeas-plugin-" + VERSION + ".jar";
- static final String JMX_PLUGIN = "org/rhq/rhq-jmx-plugin/1.4.0-SNAPSHOT/rhq-jmx-plugin-1.4.0-SNAPSHOT.jar";
+ static final String JMX_PLUGIN = "org/rhq/rhq-jmx-plugin/" + VERSION + "/rhq-jmx-plugin-" + VERSION + ".jar";
String m2RepoDir;
commit b98aefb0383974059cfa56b7212f4c7a0f4792ff
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 20:20:22 2010 -0500
plugin validator caught this error - the service resource had createDeletePolicy set to both but the resource component's parent did not have create-child facet implemented and its delete facet method was empty (so it wasn't really implemented either). removing createDeletePolicy
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
index cc8cb16..7a86201 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
@@ -42,7 +42,7 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.plugins.apache.mapping.ApacheAugeasMapping;
import org.rhq.plugins.apache.util.AugeasNodeSearch;
-public class ApacheIfModuleDirectoryComponent implements ResourceComponent<ApacheDirectoryComponent>, ConfigurationFacet, DeleteResourceFacet{
+public class ApacheIfModuleDirectoryComponent implements ResourceComponent<ApacheDirectoryComponent>, ConfigurationFacet {
private ResourceContext<ApacheDirectoryComponent> context;
private List<String> position;
@@ -102,9 +102,6 @@ public class ApacheIfModuleDirectoryComponent implements ResourceComponent<Apach
report.setStatus(ConfigurationUpdateStatus.FAILURE);
}
}
- public void deleteResource() throws Exception {
-
- }
private AugeasNode getNode(AugeasNode virtualHost) {
List<AugeasNode> directories = AugeasNodeSearch.getNodeByParentParams(virtualHost, IFMODULE_DIRECTIVE_NAME, position);
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index 930f3fc..0668ccb 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -707,7 +707,7 @@
&UseCanonicalName;
&UseCanonicalPhysicalPort;
</resource-configuration>
- <service name="IfModule Parameters" discovery="ApacheIfModuleDirectoryDiscoveryComponent" class="ApacheIfModuleDirectoryComponent" createDeletePolicy="both">
+ <service name="IfModule Parameters" discovery="ApacheIfModuleDirectoryDiscoveryComponent" class="ApacheIfModuleDirectoryComponent">
<resource-configuration>
&IfModulePosition;
&Order;
commit ac72b22b34f6ccf523e434f29c5b972f855a7b11
Merge: 091f599... d882f20...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 19:26:22 2010 -0500
Merge branch 'bundle' into master-copy
Conflicts:
.classpath
modules/core/dbutils/pom.xml
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigurationManager.java
modules/enterprise/server/ear/pom.xml
modules/enterprise/server/plugins/pom.xml
diff --cc .classpath
index fe06650,1a35400..04464c1
--- a/.classpath
+++ b/.classpath
@@@ -1,9 -1,8 +1,10 @@@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src" path="modules/common/filetemplate-bundle/src/main/java"/>
+ <classpathentry kind="src" path="modules/common/filetemplate-bundle/src/test/java"/>
+ <classpathentry kind="src" path="modules/enterprise/gui/base-perspective-jar/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/nss/src/main/java"/>
- <classpathentry kind="src" path="etc/modules/base-perspective-war/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/>
diff --cc modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 8169695,b2b3b11..74c6038
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@@ -3157,30 -3182,77 +3182,88 @@@
FOREIGN KEY (BUNDLE_DEPLOY_ID)
REFERENCES RHQ_BUNDLE_DEPLOY (ID)
</statement>
- </schema-directSQL>
+ </schema-directSQL>
<schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="SUBJECT_NAME" columnType="VARCHAR2" precision="255" />
<schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" nullable="FALSE" />
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" nullable="FALSE" />
<schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_ACTION" columnType="VARCHAR2" precision="50" />
<schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_ACTION" nullable="FALSE" />
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_MESSAGE" columnType="LONGVARCHAR" />
-
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_MESSAGE" columnType="LONGVARCHAR" />
+
<!-- Changes to RHQ_BUNDLE_FILE -->
- <schema-alterColumn table="RHQ_BUNDLE_FILE" column="PACKAGE_VERSION_ID" nullable="FALSE" />
-
+ <schema-alterColumn table="RHQ_BUNDLE_FILE" column="PACKAGE_VERSION_ID" nullable="FALSE" />
</schemaSpec>
-
+
+ <schemaSpec version="2.78.1">
+ <schema-addColumn table="RHQ_BUNDLE" column="REPO_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE foreign key relation to RHQ_REPO">
+ ALTER TABLE RHQ_BUNDLE
+ ADD CONSTRAINT RHQ_REPO_ID_FK
+ FOREIGN KEY (REPO_ID)
+ REFERENCES RHQ_REPO (ID)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+ <schemaSpec version="2.79">
+ <schema-directSQL>
+ <statement desc="Normalizing resource group descriptions">
+ UPDATE RHQ_RESOURCE_GROUP SET DESCRIPTION = NULL WHERE DESCRIPTION = ''
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+ <schemaSpec version="2.82">
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_SAVED_SEARCH">
+ CREATE TABLE RHQ_SAVED_SEARCH ( ID INTEGER )
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL>
+ <statement desc="Creating primary key for RHQ_AFFINITY_GROUP">
+ ALTER TABLE RHQ_SAVED_SEARCH ADD PRIMARY KEY ( ID )
+ </statement>
+ </schema-directSQL>
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" columnType="VARCHAR2" precision="25" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" nullable="FALSE" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="NAME" columnType="VARCHAR2" precision="200" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="DESCRIPTION" columnType="VARCHAR2" precision="500" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="PATTERN" columnType="VARCHAR2" precision="1000" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="PATTERN" nullable="FALSE" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="JPQL_TRANSLATION" columnType="VARCHAR2" precision="4000" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="LAST_COMPUTE_TIME" columnType="LONG" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="LAST_COMPUTE_TIME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="RESULT_COUNT" columnType="LONG" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="SUBJECT_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="SUBJECT_ID" nullable="FALSE" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" columnType="BOOLEAN" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" nullable="FALSE" />
+
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Inserting global default saved search 'Downed Platforms'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (1, 'Resource', 'Downed Platforms', 'All downed machines across the entire enterprise', 'down platform', 0, 1, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Inserting global default saved search 'Downed Platforms'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (1, 'Resource', 'Downed Platforms', 'All downed machines across the entire enterprise', 'down platform', 0, 1, 1)
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Inserting global default saved search 'Downed Servers'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (2, 'Resource', 'Downed Servers', 'All downed servers across the entire enterprise', 'down server', 0, 1, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Inserting global default saved search 'Downed Servers'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (2, 'Resource', 'Downed Servers', 'All downed servers across the entire enterprise', 'down server', 0, 1, 1)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --cc modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
index 573e9c0,27a1375..4732698
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
@@@ -348,60 -343,35 +348,60 @@@ public class SystemInfoFactory
public static TemplateEngine fetchTemplateEngine() {
- try{
- SystemInfo systemInfo = createSystemInfo();
-
- Map<String, String> tokens = new HashMap<String, String>();
- tokens.put(TOKEN_PREFIX+"hostname", systemInfo.getHostname());
-
- tokens.put(TOKEN_PREFIX+"os.name", systemInfo.getOperatingSystemName());
- tokens.put(TOKEN_PREFIX+"os.version", systemInfo.getOperatingSystemVersion());
- tokens.put(TOKEN_PREFIX+"os.type", systemInfo.getOperatingSystemType().toString());
- tokens.put(TOKEN_PREFIX+"cpu.count", Integer.toString(systemInfo.getNumberOfCpus()));
- tokens.put(TOKEN_PREFIX+"architecture", systemInfo.getSystemArchitecture());
-
- for (NetworkAdapterInfo networkAdapter : systemInfo.getAllNetworkAdapters()) {
- String key = TOKEN_PREFIX+"interfaces." + networkAdapter.getName();
- tokens.put(key + ".mac", networkAdapter.getMacAddressString());
- tokens.put(key + ".type", networkAdapter.getType());
- tokens.put(key + ".flags", networkAdapter.getAllFlags());
-
- if (!networkAdapter.getUnicastAddresses().isEmpty()) {
- tokens.put(key + ".address", networkAdapter.getUnicastAddresses().get(0).getHostAddress());
+ try {
+ SystemInfo systemInfo = createSystemInfo();
+
+ Map<String, String> tokens = new HashMap<String, String>();
+ tokens.put(TOKEN_PREFIX + "hostname", systemInfo.getHostname());
+
+ tokens.put(TOKEN_PREFIX + "os.name", systemInfo.getOperatingSystemName());
+ tokens.put(TOKEN_PREFIX + "os.version", systemInfo.getOperatingSystemVersion());
+ tokens.put(TOKEN_PREFIX + "os.type", systemInfo.getOperatingSystemType().toString());
+ tokens.put(TOKEN_PREFIX + "architecture", systemInfo.getSystemArchitecture());
+ try {
+ tokens.put(TOKEN_PREFIX + "cpu.count", Integer.toString(systemInfo.getNumberOfCpus()));
+ } catch (Exception e) {
+ tokens.put(TOKEN_PREFIX + "cpu.count", "?");
}
- if (!networkAdapter.getMulticastAddresses().isEmpty()) {
- tokens.put(key + ".multicast.address", networkAdapter.getMulticastAddresses().get(0).getHostAddress());
+
+ List<NetworkAdapterInfo> allNetworkAdapters = null;
+ try {
+ allNetworkAdapters = systemInfo.getAllNetworkAdapters();
+ } catch (Exception e) {
}
- }
- TemplateEngine templateEngine = new TemplateEngine(tokens);
- return templateEngine;
- }catch(Exception e){
- return new TemplateEngine(new HashMap());
+ if (allNetworkAdapters != null) {
+ for (NetworkAdapterInfo networkAdapter : allNetworkAdapters) {
+ String key = TOKEN_PREFIX + "interfaces." + networkAdapter.getName();
+ tokens.put(key + ".mac", networkAdapter.getMacAddressString());
+ tokens.put(key + ".type", networkAdapter.getType());
+ tokens.put(key + ".flags", networkAdapter.getAllFlags());
+
+ if (!networkAdapter.getUnicastAddresses().isEmpty()) {
+ tokens.put(key + ".address", networkAdapter.getUnicastAddresses().get(0).getHostAddress());
+ }
+ if (!networkAdapter.getMulticastAddresses().isEmpty()) {
+ tokens.put(key + ".multicast.address", networkAdapter.getMulticastAddresses().get(0)
+ .getHostAddress());
+ }
+ }
+ }
+
+ // create a base IP address - this one is known to java and should always exist no matter what platform we are on
+ try {
+ try {
+ tokens.put(TOKEN_PREFIX + "interfaces.java.address", InetAddress
+ .getByName(systemInfo.getHostname()).getHostAddress());
+ } catch (Exception e) {
+ tokens.put(TOKEN_PREFIX + "interfaces.java.address", InetAddress.getLocalHost().getHostAddress());
+ }
+ } catch (Exception e2) {
+ }
+
+ TemplateEngine templateEngine = new TemplateEngine(tokens);
+ return templateEngine;
+ } catch (Exception e) {
+ // some rare exception occurred that we didn't expect, rather than blow up entirely, just don't provide any values
+ return new TemplateEngine(new HashMap<String, String>());
}
}
--}
++}
commit d882f2088e1f27d64376550e1b984cf33fcd2923
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 2 15:04:05 2010 +0100
Prevent NPE
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index e5684d2..c3eda0e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2129,7 +2129,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
resourceId = parent.getId();
}
parent = getParentResource(resourceId);
- int parentId = parent.getId();
+ if (parent==null)
+ break;
if (parent.getResourceType().getCategory().equals(ResourceCategory.PLATFORM)){
resource = parent;
parent = null;
@@ -2177,7 +2178,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
//we can't assume the ordering of the provided results and the disambiguation query results
//will be the same.
-
+
//this list contains the resulting reports in the same order as the original results
List<MutableDisambiguationReport<T>> reports = new ArrayList<MutableDisambiguationReport<T>>(results.size());
@@ -2267,7 +2268,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
String parentName = (String) parentsResult[2 * i + 2];
parents.add(new ResourceParentFlyweight(parentId, parentName));
}
-
+
//update all the reports that correspond to this resourceId
for(MutableDisambiguationReport<T> report : reportsByResourceId.get(resourceId)) {
report.typeName = typeName;
@@ -2282,7 +2283,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
for (MutableDisambiguationReport<T> report : reports) {
resolution.add(report.getReport());
}
-
+
return new ResourceNamesDisambiguationResult<T>(resolution, typeResolutionNeeded, parentResolutionNeeded,
pluginResolutionNeeded);
}
commit 53f788862170e0bd8e837d4da6996d3fdff796da
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 2 11:40:09 2010 +0100
Move to a better place in the file hierarchy
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl
new file mode 100644
index 0000000..1d1a2d9
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/token2confluence.xsl
@@ -0,0 +1,28 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="text" indent="no" xml:space="default"/>
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+h2. Tokens for alert-operations sender
+
+Those tokens can be used in operation definition properties like
+'tokenclass.token' e.g. "alert.id" or "resource.name"
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="tokenClass">
+h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/>
+ <xsl:apply-templates >
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="token">
+* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_<xsl:text/>
+ </xsl:template>
+
+ <xsl:template match="fullName"/>
+ <xsl:template match="descr"/>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
deleted file mode 100644
index 1d1a2d9..0000000
--- a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
+++ /dev/null
@@ -1,28 +0,0 @@
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
- <xsl:output method="text" indent="no" xml:space="default"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="/">
-h2. Tokens for alert-operations sender
-
-Those tokens can be used in operation definition properties like
-'tokenclass.token' e.g. "alert.id" or "resource.name"
- <xsl:apply-templates />
- </xsl:template>
-
- <xsl:template match="tokenClass">
-h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/>
- <xsl:apply-templates >
- <xsl:sort select="@name"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template match="token">
-* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_<xsl:text/>
- </xsl:template>
-
- <xsl:template match="fullName"/>
- <xsl:template match="descr"/>
-
-</xsl:stylesheet>
\ No newline at end of file
commit 00727947b1936074c04a13d0d6c4d34ab1233e60
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 2 11:39:41 2010 +0100
Add an option to specify an output file.
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
index 7b2d7ff..a51f2fb 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
@@ -18,6 +18,11 @@
*/
package org.rhq.enterprise.server.plugins.alertOperations;
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
import java.util.EnumSet;
import java.util.Set;
@@ -35,9 +40,20 @@ public class PrintTokens {
public static void main(String[] args) throws Exception {
+ OutputStream out;
+ if (args.length==0)
+ out = new BufferedOutputStream(System.out);
+ else {
+ File file = new File(args[0]);
+ System.err.println("writing to " + file.getAbsolutePath());
+ out = new BufferedOutputStream(new FileOutputStream(file));
+ }
+
String text = createTokenDescription();
- System.out.println(text);
+ out.write(text.getBytes());
+ out.flush();
+ out.close();
}
/**
commit ada3ff33262675a7fd00298f078608aae0559a2e
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Mar 2 10:03:24 2010 +0100
Optimization of the style sheet
diff --git a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
index 8a2b14f..1d1a2d9 100644
--- a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
+++ b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
@@ -1,19 +1,25 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="no" xml:space="default"/>
+ <xsl:strip-space elements="*"/>
<xsl:template match="/">
h2. Tokens for alert-operations sender
+
+Those tokens can be used in operation definition properties like
+'tokenclass.token' e.g. "alert.id" or "resource.name"
<xsl:apply-templates />
</xsl:template>
<xsl:template match="tokenClass">
-h3. *<xsl:value-of select="@name"/>*: <xsl:value-of select="@description"/>
- <xsl:apply-templates/>
+h3. *Token Class '<xsl:value-of select="@name"/>'* <xsl:value-of select="@description"/>
+ <xsl:apply-templates >
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
</xsl:template>
<xsl:template match="token">
-* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_
+* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_<xsl:text/>
</xsl:template>
<xsl:template match="fullName"/>
commit a197c85ba3abdcf2e5bc6cf45a21f292f90ee6d3
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 1 22:20:25 2010 +0100
Fix generated xml, provide a list of tokens and a way to translate them to confluence markup.
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
index 79ff62e..7b2d7ff 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
@@ -58,7 +58,7 @@ public class PrintTokens {
Set<Token> tokens = Token.getByTokenClass(tc);
for (Token token : tokens) {
builder.append(" <token name=\"").append(token.getName()).append(CLOSE);
- builder.append(" <fullName>").append(token.getText()).append(CLOSE);
+ builder.append(" <fullName>").append(token.getText()).append("</fullName>\n");
builder.append(" <descr>").append(token.getDescription()).append("</descr>\n");
builder.append(" </token>\n");
diff --git a/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
new file mode 100644
index 0000000..8a2b14f
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/token2confluence.xsl
@@ -0,0 +1,22 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="text" indent="no" xml:space="default"/>
+
+ <xsl:template match="/">
+h2. Tokens for alert-operations sender
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="tokenClass">
+h3. *<xsl:value-of select="@name"/>*: <xsl:value-of select="@description"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="token">
+* *<xsl:value-of select="@name"/>*: _<xsl:value-of select="descr"/>_
+ </xsl:template>
+
+ <xsl:template match="fullName"/>
+ <xsl:template match="descr"/>
+
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-operations/tokens.xml b/modules/enterprise/server/plugins/alert-operations/tokens.xml
new file mode 100644
index 0000000..2c29789
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/tokens.xml
@@ -0,0 +1,137 @@
+<!-- this file was generated from the Token + TokenClass enums via PrintTokens tool -->
+<tokenClasses>
+ <tokenClass name="alert" description="Information about the alert itself">
+ <token name="willBeDisabled">
+ <fullName>alert.willBeDisabled</fullName>
+ <descr>Will the alert definition be disabled after firing?</descr>
+ </token>
+ <token name="id">
+ <fullName>alert.id</fullName>
+ <descr>The id of this particular alert</descr>
+ </token>
+ <token name="url">
+ <fullName>alert.url</fullName>
+ <descr>Url to the alert details page</descr>
+ </token>
+ <token name="name">
+ <fullName>alert.name</fullName>
+ <descr>Name from the defining alert definition</descr>
+ </token>
+ <token name="priority">
+ <fullName>alert.priority</fullName>
+ <descr>Priority of this alert</descr>
+ </token>
+ <token name="description">
+ <fullName>alert.description</fullName>
+ <descr>Description of this alert</descr>
+ </token>
+ <token name="firedAt">
+ <fullName>alert.firedAt</fullName>
+ <descr>Time the alert fired</descr>
+ </token>
+ <token name="conditions">
+ <fullName>alert.conditions</fullName>
+ <descr>A text representation of the conditions that led to this alert</descr>
+ </token>
+ <token name="willRecover">
+ <fullName>alert.willRecover</fullName>
+ <descr>?? TODO</descr>
+ </token>
+ </tokenClass>
+ <tokenClass name="resource" description="Information about the resource that triggered the alert">
+ <token name="id">
+ <fullName>resource.id</fullName>
+ <descr>Id of the resource</descr>
+ </token>
+ <token name="platformType">
+ <fullName>resource.platformType</fullName>
+ <descr>Type of the platform the resource is on</descr>
+ </token>
+ <token name="platformName">
+ <fullName>resource.platformName</fullName>
+ <descr>Name of the platform the resource is on</descr>
+ </token>
+ <token name="typeName">
+ <fullName>resource.typeName</fullName>
+ <descr>Resource type name</descr>
+ </token>
+ <token name="name">
+ <fullName>resource.name</fullName>
+ <descr>Name of the resource</descr>
+ </token>
+ <token name="platformId">
+ <fullName>resource.platformId</fullName>
+ <descr>Id of the platform the resource is on</descr>
+ </token>
+ <token name="parentName">
+ <fullName>resource.parentName</fullName>
+ <descr>Name of the parent resource</descr>
+ </token>
+ <token name="parentId">
+ <fullName>resource.parentId</fullName>
+ <descr>Id of the parent resource</descr>
+ </token>
+ <token name="typeId">
+ <fullName>resource.typeId</fullName>
+ <descr>Resource type id</descr>
+ </token>
+ </tokenClass>
+ <tokenClass name="targetResource" description="Information about the resource the alert is fired on ">
+ <token name="parentId">
+ <fullName>targetResource.parentId</fullName>
+ <descr>Id of the target's parent resource</descr>
+ </token>
+ <token name="platformName">
+ <fullName>targetResource.platformName</fullName>
+ <descr>Name of the platform the target resource is on</descr>
+ </token>
+ <token name="platformId">
+ <fullName>targetResource.platformId</fullName>
+ <descr>Id of the platform the target resource is on</descr>
+ </token>
+ <token name="parentName">
+ <fullName>targetResource.parentName</fullName>
+ <descr>Name of the target's parent resource</descr>
+ </token>
+ <token name="typeId">
+ <fullName>targetResource.typeId</fullName>
+ <descr>Resource type of the target resource id</descr>
+ </token>
+ <token name="platformType">
+ <fullName>targetResource.platformType</fullName>
+ <descr>Type of the platform the target resource is on</descr>
+ </token>
+ <token name="name">
+ <fullName>targetResource.name</fullName>
+ <descr>Name of the target resource</descr>
+ </token>
+ <token name="id">
+ <fullName>targetResource.id</fullName>
+ <descr>Id of the target resource</descr>
+ </token>
+ <token name="typeName">
+ <fullName>targetResource.typeName</fullName>
+ <descr>Resource type name of the target resource</descr>
+ </token>
+ </tokenClass>
+ <tokenClass name="operation" description="Information about the triggered operation">
+ <token name="id">
+ <fullName>operation.id</fullName>
+ <descr>Id of the operation fired</descr>
+ </token>
+ <token name="name">
+ <fullName>operation.name</fullName>
+ <descr>Name of the operation fired</descr>
+ </token>
+ </tokenClass>
+ <tokenClass name="test" description="Just some dummies for internal testing purposes">
+ <token name="echo">
+ <fullName>test.echo</fullName>
+ <descr>Echo the input</descr>
+ </token>
+ <token name="fix">
+ <fullName>test.fix</fullName>
+ <descr>Return a fixed string</descr>
+ </token>
+ </tokenClass>
+</tokenClasses>
commit 653e41c57c1fb6facc52ba3d22c20259f9717141
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 1 21:47:17 2010 +0100
Support more tokens
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/AlertTokenReplacer.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/AlertTokenReplacer.java
new file mode 100644
index 0000000..e8c61dd
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/AlertTokenReplacer.java
@@ -0,0 +1,231 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.Date;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.server.alert.AlertManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Helper to replace tokens by their values
+ * @author Heiko W. Rupp
+ */
+public class AlertTokenReplacer {
+
+ private final Log log = LogFactory.getLog(AlertTokenReplacer.class);
+ public static final String NOT_YET_IMPLEMENTED = " - not yet implemented -";
+ protected static final String THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG = "TheQuickBrownFoxJumpsOverTheLazyDOg";
+ private Alert alert;
+ private Pattern pattern;
+ private OperationDefinition operationDefinition;
+ private Resource targetResource;
+
+ public AlertTokenReplacer(Alert alert, OperationDefinition operationDefinition, Resource targetResource) {
+ this.alert = alert;
+ this.operationDefinition = operationDefinition;
+ pattern = Pattern.compile("<%\\s*([a-z]+\\.[a-z0-9]+)\\s*%>");
+ }
+
+ /**
+ * Replace all tokens on the input line. If no tokens are found the input is returned.
+ * Tokens have the form '<i><% class.sub %></i>'
+ * @param input a line of text
+ * @return input with tokens replaced.
+ * @see org.rhq.enterprise.server.plugins.alertOperations.Token
+ * @see org.rhq.enterprise.server.plugins.alertOperations.TokenClass
+ */
+ public String replaceTokens(String input) {
+
+ String work = input;
+ Matcher matcher = pattern.matcher(work);
+ if (!matcher.find()) {
+ log.warn("No tokens found in " + input);
+ return input;
+ }
+ matcher.reset();
+
+ do {
+ matcher = pattern.matcher(work);
+ if (!matcher.find()) {
+ break;
+ }
+ String replacement = replaceToken(matcher.group(1) );
+ String s = matcher.replaceFirst(replacement);
+ work = s;
+
+ } while (true);
+
+ return work;
+ }
+
+
+
+ /**
+ * Replace the token string passed (without the token delimiters ) with the actual value
+ * @param tokenString Input like alert.id
+ * @return replacement string or the input if the token was not valid.
+ */
+ public String replaceToken(String tokenString) {
+
+ // Ok, we have at least one token. Now split the tokenString and loop over the tokens
+
+ if (!tokenString.contains("."))
+ return tokenString;
+
+ String tmp = tokenString.substring(0, tokenString.indexOf("."));
+ TokenClass tc = TokenClass.getByText(tmp);
+ if (tc==null) {
+ log.warn("Unknown token class in [" + tokenString + "], not replacing tokens");
+ return tokenString;
+ }
+
+ Token token = Token.getByText(tokenString);
+ if (token == null) {
+ log.warn("No known token found in [" + tokenString + "], not replacing token");
+ return tokenString;
+ }
+ String ret = null;
+ switch (tc) {
+ case ALERT:
+ ret = replaceAlertToken(token,alert);
+ break;
+ case RESOURCE:
+ ret = replaceResourceToken(token,alert.getAlertDefinition().getResource());
+ break;
+ case TARGET_RESOURCE:
+ // Create a "pseudo" token to feed it into the plain resource replacement code
+ String text = "resource." + token.getName();
+ Token tok = Token.getByText(text);
+ ret = replaceResourceToken(tok, targetResource);
+ break;
+ case OPERATION:
+ ret = replaceOperationToken(token);
+ break;
+ case TEST:
+ switch (token) {
+ case TEST_ECHO:
+ ret = tokenString;
+ break;
+ case TEST_FIX:
+ ret = THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG;
+ break;
+ default:
+ ret = NOT_YET_IMPLEMENTED;
+ }
+ break;
+ }
+ return ret;
+ }
+
+ private String replaceAlertToken(Token token, Alert alert) {
+
+ AlertManagerLocal mgr = LookupUtil.getAlertManager();
+
+ switch (token) {
+ case ALERT_ID:
+ return String.valueOf(alert.getId());
+ case ALERT_FIRE_TIME:
+ return new Date(alert.getCtime()).toString(); // TODO use a specific impl here?
+ case ALERT_WILL_RECOVER:
+ return String.valueOf(alert.getAlertDefinition().getWillRecover());
+ case ALERT_WILL_DISABLE:
+ return String.valueOf(mgr.willDefinitionBeDisabled(alert));
+ case ALERT_DEF_NAME:
+ return alert.getAlertDefinition().getName();
+ case ALERT_DEF_DESC:
+ return alert.getAlertDefinition().getDescription();
+ case ALERT_DEF_PRIO:
+ return alert.getAlertDefinition().getPriority().getName();
+ case ALERT_URL:
+ return mgr.prettyPrintAlertURL(alert);
+ case ALERT_CONDITIONS:
+ return mgr.prettyPrintAlertConditions(alert,false);
+
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+
+ }
+
+ private String replaceResourceToken(Token token, Resource resource) {
+
+ ResourceManagerLocal mgr = LookupUtil.getResourceManager();
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ Resource parent;
+ Resource platform = mgr.getPlaformOfResource(overlord,resource.getId());
+
+ switch (token) {
+ case RESOURCE_ID:
+ return String.valueOf(resource.getId());
+ case RESOURCE_NAME:
+ return resource.getName();
+ case RESOURCE_PARENT_ID:
+ parent = mgr.getParentResource(resource.getId());
+ if (parent==null)
+ return "0";
+ else
+ return String.valueOf(parent.getId());
+ case RESOURCE_PARENT_NAME:
+ parent = mgr.getParentResource(resource.getId());
+ if (parent==null)
+ return "0";
+ else
+ return String.valueOf(parent.getId());
+ case RESOURCE_TYPE_ID:
+ return String.valueOf(resource.getResourceType().getId());
+ case RESOURCE_TYPE_NAME:
+ return resource.getResourceType().getName();
+ case RESOURCE_PLATFORM_ID:
+ return String.valueOf(platform.getId());
+ case RESOURCE_PLATFORM_NAME:
+ return platform.getName();
+ case RESOURCE_PLATFORM_TYPE:
+ return platform.getResourceType().getName();
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+ }
+
+ private String replaceOperationToken(Token token) {
+
+ switch (token) {
+ case OPERATION_ID:
+ return String.valueOf(operationDefinition.getId());
+ case OPERATION_NAME:
+ return operationDefinition.getName();
+
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
index 4f6c88e..635085a 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
@@ -78,9 +78,11 @@ public class OperationsSender extends AlertSender {
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO get real subject
List<OperationDefinition> opdefs = opMgr.findSupportedResourceOperations(subject,resourceId,false);
- for (OperationDefinition opdef : opdefs ) {
- if (opdef.getId() == opId) {
- opName = opdef.getName();
+ OperationDefinition opDef = null;
+ for (OperationDefinition tmp : opdefs ) {
+ if (tmp.getId() == opId) {
+ opName = tmp.getName();
+ opDef = tmp;
break;
}
}
@@ -110,7 +112,7 @@ public class OperationsSender extends AlertSender {
if (parameters!=null && tokenMode.equals(INTERPRETED)) {
Map<String,PropertySimple> propsMap = parameters.getSimpleProperties();
if (!propsMap.isEmpty()) {
- TokenReplacer tr = new TokenReplacer(alert);
+ AlertTokenReplacer tr = new AlertTokenReplacer(alert, opDef, null);
for (PropertySimple prop : propsMap.values()) {
String tmp = prop.getStringValue();
tmp = tr.replaceTokens(tmp);
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
index 78ac850..79ff62e 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
@@ -35,6 +35,17 @@ public class PrintTokens {
public static void main(String[] args) throws Exception {
+ String text = createTokenDescription();
+
+ System.out.println(text);
+ }
+
+ /**
+ * Do the work and return an xml structure that lists available token classes and
+ * tokens along with their descriptions.
+ * @return String with an XML representation of the available tokens
+ */
+ public static String createTokenDescription() {
EnumSet<TokenClass> tokenClasses = EnumSet.allOf(TokenClass.class);
StringBuilder builder = new StringBuilder("<tokenClasses>\n");
@@ -58,7 +69,6 @@ public class PrintTokens {
}
builder.append("</tokenClasses>\n");
-
- System.out.println(builder.toString());
+ return builder.toString();
}
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
index e665bd4..2d810f0 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
@@ -43,11 +43,25 @@ public enum Token {
// resource that triggered the alert related tokens
RESOURCE_ID(TokenClass.RESOURCE, "id", "Id of the resource"),
RESOURCE_NAME(TokenClass.RESOURCE, "name", "Name of the resource"),
+ RESOURCE_PARENT_ID(TokenClass.RESOURCE, "parentId", "Id of the parent resource"),
+ RESOURCE_PARENT_NAME(TokenClass.RESOURCE, "parentName", "Name of the parent resource"),
+ RESOURCE_TYPE_ID(TokenClass.RESOURCE,"typeId","Resource type id"),
+ RESOURCE_TYPE_NAME(TokenClass.RESOURCE,"typeName","Resource type name"),
+ RESOURCE_PLATFORM_ID(TokenClass.RESOURCE,"platformId", "Id of the platform the resource is on"),
+ RESOURCE_PLATFORM_NAME(TokenClass.RESOURCE,"platformName", "Name of the platform the resource is on"),
+ RESOURCE_PLATFORM_TYPE(TokenClass.RESOURCE,"platformType", "Type of the platform the resource is on"),
// resource the operation is run on related tokens
TRESOURCE_ID(TokenClass.TARGET_RESOURCE, "id","Id of the target resource"),
TRESOURCE_NAME(TokenClass.TARGET_RESOURCE, "name", "Name of the target resource"),
+ TRESOURCE_PARENT_ID(TokenClass.TARGET_RESOURCE, "parentId", "Id of the target's parent resource"),
+ TRESOURCE_PARENT_NAME(TokenClass.TARGET_RESOURCE, "parentName", "Name of the target's parent resource"),
+ TRESOURCE_TYPE_ID(TokenClass.TARGET_RESOURCE,"typeId","Resource type of the target resource id"),
+ TRESOURCE_TYPE_NAME(TokenClass.TARGET_RESOURCE,"typeName","Resource type name of the target resource"),
+ TRESOURCE_PLATFORM_ID(TokenClass.TARGET_RESOURCE,"platformId", "Id of the platform the target resource is on"),
+ TRESOURCE_PLATFORM_NAME(TokenClass.TARGET_RESOURCE,"platformName", "Name of the platform the target resource is on"),
+ TRESOURCE_PLATFORM_TYPE(TokenClass.TARGET_RESOURCE,"platformType", "Type of the platform the target resource is on"),
// Information about the fired operation
@@ -56,9 +70,7 @@ public enum Token {
// only for testing
TEST_ECHO(TokenClass.TEST,"echo", "Echo the input"),
- TEST_FIX(TokenClass.TEST,"fix", "Return a fixed string")
-
- ;
+ TEST_FIX(TokenClass.TEST,"fix", "Return a fixed string");
private TokenClass tc;
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java
deleted file mode 100644
index 0b230b4..0000000
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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.plugins.alertOperations;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.resource.Resource;
-
-/**
- * Helper to replace tokens by their values
- * @author Heiko W. Rupp
- */
-public class TokenReplacer {
-
- private final Log log = LogFactory.getLog(TokenReplacer.class);
- private static final String NOT_YET_IMPLEMENTED = " - not yet implemented -";
- protected static final String THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG = "TheQuickBrownFoxJumpsOverTheLazyDOg";
- private Alert alert;
- private Pattern pattern;
-
- public TokenReplacer(Alert alert) {
- this.alert = alert;
- pattern = Pattern.compile("<%\\s*([a-z]+\\.[a-z0-9]+)\\s*%>");
- }
-
- /**
- * Replace all tokens on the input line. If no tokens are found the input is returned.
- * Tokens have the form '<i><% class.sub %></i>'
- * @param input a line of text
- * @return input with tokens replaced.
- * @see org.rhq.enterprise.server.plugins.alertOperations.Token
- * @see org.rhq.enterprise.server.plugins.alertOperations.TokenClass
- */
- public String replaceTokens(String input) {
-
- String work = input;
- Matcher matcher = pattern.matcher(work);
- if (!matcher.find()) {
- log.warn("No tokens found in " + input);
- return input;
- }
- matcher.reset();
-
- do {
-// System.out.println(input);
- matcher = pattern.matcher(work);
- if (!matcher.find()) {
- break;
- }
-// System.out.println(matcher.regionStart() + ":" + matcher.regionEnd() + input.substring(matcher.regionStart(),matcher.regionEnd()));
-// System.out.println(matcher.group(1));
- String replacement = replaceToken(matcher.group(1) );
- String s = matcher.replaceFirst(replacement);
-// System.out.println(s);
- work = s;
-
-// System.out.println("----");
- } while (true);
-
- return work;
- }
-
-
-
- /**
- * Replace the token string passed (without the token delimiters ) with the actual value
- * @param tokenString Input like alert.id
- * @return replacement string or the input if the token was not valid.
- */
- public String replaceToken(String tokenString) {
-
- // Ok, we have at least one token. Now split the tokenString and loop over the tokens
-
- if (!tokenString.contains("."))
- return tokenString;
-
- String tmp = tokenString.substring(0, tokenString.indexOf("."));
- TokenClass tc = TokenClass.getByText(tmp);
- if (tc==null) {
- log.warn("Unknown token class in [" + tokenString + "], not replacing tokens");
- return tokenString;
- }
-
- Token token = Token.getByText(tokenString);
- if (token == null) {
- log.warn("No known token found in [" + tokenString + "], not replacing token");
- return tokenString;
- }
- String ret = null;
- switch (tc) {
- case ALERT:
- ret = replaceAlertToken(token,alert);
- break;
- case RESOURCE:
- ret = replaceResourceToken(token,alert.getAlertDefinition().getResource());
- break;
- case TARGET_RESOURCE:
- Resource resource = null; // TODO
- ret = replaceTargetResourceToken(token, resource);
- break;
- case TEST:
- switch (token) {
- case TEST_ECHO:
- ret = tokenString;
- break;
- case TEST_FIX:
- ret = THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG;
- break;
- default:
- ret = NOT_YET_IMPLEMENTED;
- }
- break;
- }
- return ret;
- }
-
- private String replaceAlertToken(Token token, Alert alert) {
-
- switch (token) {
- case ALERT_ID:
- return String.valueOf(alert.getId());
- case ALERT_URL:
- return NOT_YET_IMPLEMENTED;
-
- default:
- return NOT_YET_IMPLEMENTED;
- }
-
- }
-
- private String replaceResourceToken(Token token, Resource resource) {
-
- switch (token) {
- case RESOURCE_ID:
- return String.valueOf(resource.getId());
- case RESOURCE_NAME:
- return resource.getName();
-
- default:
- return NOT_YET_IMPLEMENTED;
- }
- }
-
- private String replaceTargetResourceToken(Token token, Resource resource) {
-
- switch (token) {
- case TRESOURCE_ID:
- return String.valueOf(resource.getId());
- case TRESOURCE_NAME:
- return resource.getName();
-
- default:
- return NOT_YET_IMPLEMENTED;
- }
- }
-
-}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java b/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java
index f41fc85..cf6c48d 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java
@@ -18,12 +18,15 @@
*/
package org.rhq.enterprise.server.plugins.alertOperations;
+import java.util.EnumSet;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.annotations.Test;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.core.domain.resource.Resource;
/**
@@ -42,17 +45,18 @@ public class TokenReplacementTest {
public void testSimpleReplacement() throws Exception {
Alert al = new Alert();
- TokenReplacer tr = new TokenReplacer(al);
+ AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);
String res = tr.replaceToken("test.fix");
assert res != null;
- assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
+ assert res.equals(AlertTokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
res = tr.replaceToken(TEST_ECHO);
assert res != null;
assert res.equals(TEST_ECHO);
+/*
res = tr.replaceToken("alert.id");
assert res != null;
assert res.equals("0");
@@ -62,18 +66,19 @@ public class TokenReplacementTest {
AlertDefinition def = new AlertDefinition();
def.setResource(r);
al = new Alert(def, System.currentTimeMillis());
- tr = new TokenReplacer(al);
+ tr = new AlertTokenReplacer(al, null, null);
res = tr.replaceToken("resource.id");
assert "1234".equals(res);
res = tr.replaceToken("resource.name");
assert "A resource".equals(res);
+*/
}
public void testInvalidTokenString() {
Alert al = new Alert();
- TokenReplacer tr = new TokenReplacer(al);
+ AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);
String res = tr.replaceToken(FOO_BAR);
@@ -93,13 +98,13 @@ public class TokenReplacementTest {
public void testFullTokenSimple() {
Alert al = new Alert();
- TokenReplacer tr = new TokenReplacer(al);
+ AlertTokenReplacer tr = new AlertTokenReplacer(al, null, null);
String res = tr.replaceTokens("<%test.fix%>");
assert res != null;
assert !res.equals("<%test.fix%>") : "Res was " + res;
- assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
+ assert res.equals(AlertTokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
String TF2 = "<% test.fix %>";
res = tr.replaceTokens(TF2);
@@ -120,16 +125,67 @@ public class TokenReplacementTest {
assert res != null;
assert res.equals(FOO_BAR) : "Res was " + res;
+/*
Resource r = new Resource(1234);
r.setName("A resource");
AlertDefinition def = new AlertDefinition();
def.setResource(r);
al = new Alert(def, System.currentTimeMillis());
- tr = new TokenReplacer(al);
+ tr = new AlertTokenReplacer(al, null, null);
res = tr.replaceTokens("<% test.fix%><%resource.id%>");
assert res!=null;
- assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG+"1234");
+ assert res.equals(AlertTokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG+"1234");
+*/
+ }
+
+ public void testOperationTokens() {
+ Resource r = new Resource(1234);
+ AlertDefinition def = new AlertDefinition();
+ def.setResource(r);
+ Alert al = new Alert(def, System.currentTimeMillis());
+
+ AlertTokenReplacer tr;
+ OperationDefinition opDef = new OperationDefinition(123,"helloOps",null,"This is a test",0,"Just testing");
+ tr = new AlertTokenReplacer(al,opDef, null);
+ String res = tr.replaceTokens("<%operation.id%>");
+ assert res!=null;
+ assert res.equals("123") : "Result is " + res;
+ res = tr.replaceTokens("<%operation.name%>");
+ assert res!=null;
+ assert res.equals("helloOps");
+ }
+
+ public void testTokenPrinter() {
+
+ String result = PrintTokens.createTokenDescription();
+ assert result != null;
+ assert !result.isEmpty();
+ assert result.contains("<token ");
}
+/*
+ public void testReplaceAllTokens() {
+
+ EnumSet<Token> tokens = EnumSet.allOf(Token.class);
+
+ Resource r = new Resource(1234);
+ AlertDefinition def = new AlertDefinition();
+ def.setResource(r);
+ Alert al = new Alert(def, System.currentTimeMillis());
+
+ AlertTokenReplacer tr;
+ OperationDefinition opDef = new OperationDefinition(123,"helloOps",null,"This is a test",0,"Just testing");
+ tr = new AlertTokenReplacer(al,opDef, null);
+
+ for (Token token : tokens) {
+
+ String input = "<%" + token.getText() + "%>";
+ String res = tr.replaceTokens(input);
+ assert res != null;
+ assert !res.isEmpty();
+ assert !res.equals(AlertTokenReplacer.NOT_YET_IMPLEMENTED) : "Replacement for token [" + token.getText() + "] is not implemented";
+ }
+ }
+*/
}
commit 15ff7e397d9a01af13937c7d806679918e2dda7d
Author: Justin Harris <jharris(a)redhat.com>
Date: Mon Mar 1 11:26:37 2010 -0500
BZ 568796 - Changing input length on metric baseline % field.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
index 2000efd..668d175 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
@@ -372,7 +372,8 @@
converter="#{metricPercentConverter}"
required="true"
requiredMessage="#{alertMessages.percentRange}"
- validatorMessage="#{alertMessages.percentRange}">
+ validatorMessage="#{alertMessages.percentRange}"
+ size="6">
<f:validateDoubleRange minimum="0.0" maximum="1000.0" />
</h:inputText>
<h:outputLabel for="metricBaselinePercent" value=" #{messages['alert.config.props.CB.Content.Percent']} " />
commit dd92239d4a43a1ae899353f3268857de832ead3e
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 1 14:04:55 2010 +0100
Provide token descriptions and a way to get a full list of tokens defined.
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
new file mode 100644
index 0000000..78ac850
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/PrintTokens.java
@@ -0,0 +1,64 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Print the available tokens to stdout, for documentation generation purposes
+ * @author Heiko W. Rupp
+ */
+public class PrintTokens {
+
+ private final Log log = LogFactory.getLog(PrintTokens.class);
+ private static final String CLOSE = "\">\n";
+
+ public static void main(String[] args) throws Exception {
+
+ EnumSet<TokenClass> tokenClasses = EnumSet.allOf(TokenClass.class);
+
+ StringBuilder builder = new StringBuilder("<tokenClasses>\n");
+
+ for (TokenClass tc : tokenClasses ) {
+ builder.append(" <tokenClass name=\"").append(tc.getText()).
+ append("\"").append(" description=\"").append(tc.getDescription()).
+ append(CLOSE);
+
+ Set<Token> tokens = Token.getByTokenClass(tc);
+ for (Token token : tokens) {
+ builder.append(" <token name=\"").append(token.getName()).append(CLOSE);
+ builder.append(" <fullName>").append(token.getText()).append(CLOSE);
+ builder.append(" <descr>").append(token.getDescription()).append("</descr>\n");
+ builder.append(" </token>\n");
+
+ }
+
+ builder.append(" </tokenClass>\n");
+
+ }
+
+ builder.append("</tokenClasses>\n");
+
+ System.out.println(builder.toString());
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
index bcd7570..e665bd4 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
@@ -19,39 +19,59 @@
package org.rhq.enterprise.server.plugins.alertOperations;
import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Set;
/**
- * Tokens that can be replaced in
+ * Tokens that can be replaced in operation parameters
* @author Heiko W. Rupp
*/
public enum Token {
// Alert related tokens
- ALERT_ID(TokenClass.ALERT, "id"),
- ALERT_URL(TokenClass.ALERT, "url"),
+ ALERT_ID(TokenClass.ALERT, "id","The id of this particular alert"),
+ ALERT_URL(TokenClass.ALERT, "url","Url to the alert details page"),
+ ALERT_FIRE_TIME(TokenClass.ALERT, "firedAt","Time the alert fired"),
+ ALERT_WILL_RECOVER(TokenClass.ALERT,"willRecover","?? TODO"),
+ ALERT_CONDITIONS(TokenClass.ALERT,"conditions","A text representation of the conditions that led to this alert"),
+ ALERT_DEF_NAME(TokenClass.ALERT,"name","Name from the defining alert definition"),
+ ALERT_DEF_DESC(TokenClass.ALERT,"description","Description of this alert"),
+ ALERT_DEF_PRIO(TokenClass.ALERT,"priority", "Priority of this alert"),
+ ALERT_WILL_DISABLE(TokenClass.ALERT,"willBeDisabled","Will the alert definition be disabled after firing?"),
+
// resource that triggered the alert related tokens
- RESOURCE_ID(TokenClass.RESOURCE, "id"),
- RESOURCE_NAME(TokenClass.RESOURCE, "name"),
+ RESOURCE_ID(TokenClass.RESOURCE, "id", "Id of the resource"),
+ RESOURCE_NAME(TokenClass.RESOURCE, "name", "Name of the resource"),
// resource the operation is run on related tokens
- TRESOURCE_ID(TokenClass.TARGET_RESOURCE, "id"),
- TRESOURCE_NAME(TokenClass.TARGET_RESOURCE, "name"),
+ TRESOURCE_ID(TokenClass.TARGET_RESOURCE, "id","Id of the target resource"),
+ TRESOURCE_NAME(TokenClass.TARGET_RESOURCE, "name", "Name of the target resource"),
+
+ // Information about the fired operation
+ OPERATION_ID(TokenClass.OPERATION,"id","Id of the operation fired"),
+ OPERATION_NAME(TokenClass.OPERATION,"name","Name of the operation fired"),
// only for testing
- TEST_ECHO(TokenClass.TEST,"echo"),
- TEST_FIX(TokenClass.TEST,"fix")
+ TEST_ECHO(TokenClass.TEST,"echo", "Echo the input"),
+ TEST_FIX(TokenClass.TEST,"fix", "Return a fixed string")
;
+ private TokenClass tc;
+ private String name;
private String text;
+ private String description;
- private Token(TokenClass tc, String text) {
+ private Token(TokenClass tc, String name, String description) {
- this.text = tc.getText() + "." + text;
+ this.tc = tc;
+ this.name = name;
+ this.text = tc.getText() + "." + name;
+ this.description = description;
}
/**
@@ -69,4 +89,29 @@ public enum Token {
}
return null;
}
+
+ public static Set<Token> getByTokenClass(TokenClass tokenClass) {
+
+ Set<Token> tokens = new HashSet<Token>();
+
+ EnumSet<Token> es = EnumSet.allOf(Token.class);
+ for (Token t : es) {
+ if (t.tc == tokenClass)
+ tokens.add(t);
+ }
+
+ return tokens;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public String getDescription() {
+ return description;
+ }
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java
index 5125a72..16cb240 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java
@@ -26,22 +26,30 @@ import java.util.EnumSet;
*/
public enum TokenClass {
- ALERT("alert"),
- RESOURCE("resource"),
- TARGET_RESOURCE("targetResource"),
- TEST("test");
+ ALERT("alert","Information about the alert itself"),
+ RESOURCE("resource","Information about the resource that triggered the alert"),
+ TARGET_RESOURCE("targetResource","Information about the resource the alert is fired on "),
+ OPERATION("operation","Information about the triggered operation"),
+ //
+ TEST("test","Just some dummies for internal testing purposes");
private String text;
+ private String description;
- private TokenClass(String text) {
+ private TokenClass(String text,String description) {
this.text = text;
+ this.description = description;
}
public String getText() {
return text;
}
- /**
+ public String getDescription() {
+ return description;
+ }
+
+ /**
* Return the tokenclass that matches the input text or null if not found.
* The token delimiters need to be already stripped from the input
* @param input a token text like <i>alert</i>, which would return the
commit ac9103aaf2c5c999bd6f1d940ff0159072b2cbad
Merge: 79afeae... 6278e70...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 1 10:47:39 2010 +0100
Merge branch 'master' into alertPlugin
commit 79afeae9fab3bcf14508792f0007c1c773934e36
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 1 10:46:53 2010 +0100
Provide a way to initialize the backing bean after it got created and the alertParameters got injected.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
index 0896c6e..ccb5d7d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
@@ -288,6 +288,12 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
Configuration config2 = config.deepCopy(true);
bean.setAlertParameters(config2);
+ try {
+ bean.internalInit();
+ }
+ catch (Throwable t ) {
+ LOG.error("getBackinBean, calling backingBean.internalInit() resulted in " + t.getMessage());
+ }
}
}
return bean;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index e4b2d20..12312f2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -40,6 +40,13 @@ public class CustomAlertSenderBackingBean {
public void setAlertParameters(Configuration alertParameters) {
this.alertParameters = alertParameters;
}
+
+ /**
+ * This method is called after constructing the bean and injecting the
+ * #alertParameters
+ */
+ public void internalInit() {}
+
/**
* This method is called when the alert notification that uses this backing bean
* is removed, so that the backing bean can do some cleanup work
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
index 98fa0e9..dc41f01 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
@@ -67,19 +67,32 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
log.info("new " + hashCode());
}
- @Create
- public void init() {
- log.info("init");
+ @Override
+ public void internalInit() {
+/* log.info("internalInit");
+ try {
+ getResId();
+ getResourceName();
+ obtainOperationIds();
+ getOperationId();
+ lookupConfiguration();
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }*/
}
+
@Override
public void internalCleanup() {
+ log.info("internalCleanup");
PropertySimple parameterConfigProp = alertParameters.getSimple(OperationsSender.PARAMETERS_CONFIG);
if (parameterConfigProp!=null) {
Integer paramId = parameterConfigProp.getIntegerValue();
if (paramId!=null) {
ConfigurationManagerLocal cmgr = LookupUtil.getConfigurationManager();
cmgr.deleteConfigurations(Arrays.asList(paramId));
+ cleanProperty(alertParameters,OperationsSender.PARAMETERS_CONFIG);
}
}
}
@@ -92,6 +105,8 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
persistProperty(alertParameters, OperationsSender.RESOURCE_ID,resId);
cleanProperty(alertParameters,OperationsSender.OPERATION_ID);
cleanProperty(alertParameters,OperationsSender.USABLE);
+ operationIds = new HashMap<String,Integer>(); // Clean out operations dropdown
+ operationId = null;
}
@@ -116,25 +131,25 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
private void lookupConfiguration() {
-// log.info("getCD: " + configurationDefinition);
try {
// Subject subject = EnterpriseFacesContextUtility.getSubject();
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
-// int operationId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("opId"));
OperationManagerLocal opMan = LookupUtil.getOperationManager();
obtainOperationIds();
- OperationDefinition operationDefinition = opMan.getOperationDefinition(subject, operationId);
- configurationDefinition = operationDefinition.getParametersConfigurationDefinition();
+ if (operationId!=null) {
+ OperationDefinition operationDefinition = opMan.getOperationDefinition(subject, operationId);
+ configurationDefinition = operationDefinition.getParametersConfigurationDefinition();
- // call a SLSB method to get around lazy initialization of configDefs and configTemplates
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
- configuration = configurationManager.getConfigurationFromDefaultTemplate(configurationDefinition);
-// Configuration newConfiguration = configuration.deepCopy(false);
-log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " + configuration.getSimpleValue("detailedDiscovery","-unset-"));
+ // call a SLSB method to get around lazy initialization of configDefs and configTemplates
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+ configuration = configurationManager.getConfigurationFromDefaultTemplate(configurationDefinition);
+ // Configuration newConfiguration = configuration.deepCopy(false);
+ log.info("lookupConfiguration: " + configuration + ", " + configuration.hashCode() );
+ }
} catch (Exception e) {
e.printStackTrace();
}
commit 6278e7056403b2dcd0ffde84a7109e60790022eb
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 16:55:32 2010 -0500
simplify dbupgrade by merge saved search-related entries into a single schemaSpec
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 6fe555e..b2b3b11 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3231,9 +3231,7 @@
<schema-alterColumn table="RHQ_SAVED_SEARCH" column="SUBJECT_ID" nullable="FALSE" />
<schema-addColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" columnType="BOOLEAN" />
<schema-alterColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" nullable="FALSE" />
- </schemaSpec>
-
- <schemaSpec version="2.82.1">
+
<schema-directSQL>
<statement targetDBVendor="postgresql" desc="Inserting global default saved search 'Downed Platforms'">
INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
commit a6efa283222790b6e22f82861b1c145e34af9391
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 16:54:58 2010 -0500
insert some default global searches into the system during dbsetup
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml
index 1a11114..da98622 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml
@@ -10,7 +10,7 @@
DESCRIPTION="All downed machines across the entire enterprise"
PATTERN="down platform"
LAST_COMPUTE_TIME="0"
- SUBJECT="1"
+ SUBJECT_ID="1"
GLOBAL="TRUE" />
<data ID="2"
CONTEXT="Resource"
@@ -18,7 +18,7 @@
DESCRIPTION="All downed servers across the entire enterprise"
PATTERN="down server"
LAST_COMPUTE_TIME="0"
- SUBJECT="1"
+ SUBJECT_ID="1"
GLOBAL="TRUE" />
</table>
commit 1d02547312924f4904730bb0aebe7d0d8d9b70d2
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 16:21:37 2010 -0500
fix typo for column name in saved search table
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml
index 7c0de23..14634b6 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml
@@ -17,7 +17,7 @@
<column name="RESULT_COUNT" type="LONG" required="false"/>
<column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="true"/>
- <column name="ENABLED" type="BOOLEAN" required="true"/>
+ <column name="GLOBAL" type="BOOLEAN" required="true"/>
</table>
</dbsetup>
\ No newline at end of file
commit 92adfd37e105c60efc0f1981d7fc2258ee423ad5
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 16:05:08 2010 -0500
change order of dbsetup so that saved search table gets created after the rhq_subject table
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
index f5e4eae..d5be746 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
@@ -39,7 +39,7 @@ To run the default target, you must set one of the following properties to true:
<property name="dbsetup.scripts.dir" value="${basedir}/src/main/scripts/dbsetup" />
<property name="dbsetup.output.dir" value="${basedir}/target/dbsetup" /> <!-- away from classes so it doesn't go into the jar -->
<!-- define the setup creation processing order. note, removals are done in the reverse order -->
- <property name="dbsetup.subsystems" value="search,config,cluster,inventory,auth,authz,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
+ <property name="dbsetup.subsystems" value="config,cluster,inventory,auth,authz,search,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
<property name="dbsetup.combined.schema" value="${dbsetup.output.dir}/all-schema.xml" />
<property name="dbsetup.combined.data" value="${dbsetup.output.dir}/all-data.xml" />
<property name="dbsetup.tstamp.file" value="${dbsetup.output.dir}/dbsetup-combine.tstamp" />
commit d0ef49e101ef7887e834b0a9021c0c0654a7f5d5
Merge: 613b993... 8a0951a...
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 15:34:50 2010 -0500
Merge branch 'master' into search
commit 613b993b85ac47117fda5d7f7810318e891cdf0e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 15:32:41 2010 -0500
construct AST from parse tree for RHQL grammar
diff --git a/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g b/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g
index 00a0dab..ded91a1 100644
--- a/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g
+++ b/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g
@@ -27,11 +27,43 @@
* @author Joseph Marques
*/
grammar RHQL;
-
options {
language=Java;
backtrack=true;
memoize=true;
+ output=AST;
+ ASTLabelType=CommonTree;
+}
+
+/*
+ * Imaginary nodes serve to fully abstract the parse tree from the AST. This
+ * allows us, for example, to support the conjunctive ('and') operator between
+ * conditional expressions, but gives us the flexibility to modify the lexical
+ * element that represents that operation. In the future, we might want to
+ * support '&&' instead of 'and', or even support them both. The inclusion of
+ * imaginary tokens creates a more stable AST that downstream grammars can use
+ * without fear that every change to the syntax will break their tree parser.
+ */
+tokens {
+ OR;
+ AND;
+
+ CONTEXT;
+ LINEAGE;
+ PATH;
+ PARAM;
+ IDENT;
+ VALUE;
+
+ OP_EQUALS;
+ OP_EQUALS_STRICT;
+ OP_NULL;
+ OP_IN;
+
+ OP_NOT_EQUALS;
+ OP_NOT_EQUALS_STRICT;
+ OP_NOT_NULL;
+ OP_NOT_IN;
}
@header {
@@ -41,26 +73,29 @@ options {
package org.rhq.enterprise.server.search;
}
+
/*
* parser rules
*/
searchExpression
- : conditionalExpression
+ : conditionalExpression { System.out.println($conditionalExpression.tree.toStringTree()); }
;
conditionalExpression
- : conditionalFactor ( 'or' conditionalFactor )*
- ;
+ : conds+=conditionalFactor ( WS* ( 'or' ) WS* conds+=conditionalFactor )* -> { $conds.size() == 1 }? ^($conds)
+ -> ^(OR conditionalFactor+)
+ ; // use rewrite predicates to eliminate superfluous 'or' node if only one child
conditionalFactor
- : conditionalPrimary ( ( 'and' )? conditionalPrimary )*
- ;
+ : conds+=conditionalPrimary ( WS* ( 'and' WS* )? conds+=conditionalPrimary )* -> { $conds.size() == 1 }? ^($conds)
+ -> ^(AND conditionalPrimary+)
+ ; // use rewrite predicates to eliminate superfluous 'and' node if only one child
conditionalPrimary
- : simpleConditionalExpression
- | '(' conditionalExpression ')'
- ;
+ : WS* simpleConditionalExpression WS* -> simpleConditionalExpression
+ | '(' WS* conditionalExpression WS* ')' -> conditionalExpression
+ ; // avoid building nodes for parens, tree structure implies existence appropriately -- ignore captured WS
simpleConditionalExpression
: comparisonConditionalExpression
@@ -69,69 +104,78 @@ simpleConditionalExpression
;
comparisonConditionalExpression
- : context comparisonOperator identifier
- ;
+ : c=context WS* op=comparisonOperator WS* ident=identifier -> ^($op $c ^(VALUE $ident))
+ ; // rewrite tree output so operator is always the root -- ignore captured WS
nullComparisonConditionalExpression
- : context nullOperator
- ;
+ : c=context WS* op=nullOperator -> ^($op $c)
+ ; // rewrite tree output so operator is always the root -- ignore captured WS
inExpression
- : context inOperator '[' '='? identifier ( ',' '='? identifier )* ']'
- ;
+ : c=context WS* op=inOperator WS* '[' WS* ids+=identifier WS* ( ',' WS* ids+=identifier WS* )* ']'
+ -> ^($op $c ^(VALUE $ids+))
+ ; // rewrite tree output so operator is always the root -- ignore captured WS
context
- : ( lineage '.' )? path ( '[' identifier ']' )?
+ : ( l=lineage '.' )? p=path ( '[' ident=identifier ']' )? -> ^(CONTEXT ^(LINEAGE $l)? ^(PATH $p) ^(PARAM $ident)?)
;
lineage
- : path ( '(' INT ')' )?
- ;
+ : path ( '('! LEVEL ')'! )?
+ ; // avoid building nodes for brackets, tree structure implies existence appropriately
path
: ID+
;
identifier
- : quotedValue
- | value
+ : doubleQuotedValue -> ^(IDENT doubleQuotedValue)
+ | quotedValue -> ^(IDENT quotedValue)
+ | openEndedvalue -> ^(IDENT openEndedvalue)
;
+doubleQuotedValue
+ : '"'! ~('"')* '"'!
+ ; // avoid building nodes for the double-quote characters
+
+
quotedValue
- : '\'' ~('\'')* '\''
- ;
+ : '\''! ~('\'')* '\''!
+ ; // avoid building nodes for the sinngle-quote characters
-value
- : ~('\'') ~(']'|','|')')*
- ;
+openEndedvalue
+ : ~(']' | ',' | ')' | '(' | 'or' | 'and' | WS )*
+ ; // consume until we find a char to terminate the current phrase ']' ',' ')' or begin the next '(' 'or' 'and'
comparisonOperator
- : '='
- | '=='
- | '!='
- | '!=='
- ;
+ : '=' -> ^(OP_EQUALS)
+ | '==' -> ^(OP_EQUALS_STRICT)
+ | '!=' -> ^(OP_NOT_EQUALS)
+ | '!==' -> ^(OP_NOT_EQUALS_STRICT)
+ ; // use imaginary nodes for all operators, which further removes the AST from the real lexical elements
nullOperator
- : 'is' 'not'? 'null'
- ;
+ : 'is' WS+ (negation='not' WS+)? 'null' -> { $negation == null }? ^(OP_NULL)
+ -> ^(OP_NOT_NULL)
+ ; // use imaginary nodes for all operators, which further removes the AST from the real lexical elements
inOperator
- : 'not'? 'in'
- ;
+ : (negation+='not' WS+)? 'in' -> { $negation == null }? ^(OP_IN)
+ -> ^(OP_NOT_IN)
+ ; // use imaginary nodes for all operators, which further removes the AST from the real lexical elements
/*
* lexical elements
- */
+ */
ID
: 'a'..'z'
;
-INT
- : '0'..'9'
+LEVEL
+ : '0'..'5'
;
WS
- : ( ' ' | '\n' | '\r' )+ { $channel = HIDDEN; }
+ : ( ' ' | '\n' | '\r' )+
;
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java
index 637e339..ceab3e3 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java
@@ -62,6 +62,7 @@ public class RHQLTest extends AssertJUnit {
@Override
public TestResult call() throws Exception {
try {
+ System.out.println(line);
ANTLRStringStream input = new ANTLRStringStream(line); // Create an input character stream from standard in
RHQLLexer lexer = new RHQLLexer(input); // Create an echoLexer that feeds from that stream
CommonTokenStream tokens = new CommonTokenStream(lexer); // Create a stream of tokens fed by the lexer
commit eac78662084095c22fb80326643fbf59f0e1a863
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 26 15:31:54 2010 -0500
modify RHQL test case file to adhere to simpler syntax for IN-clause:
* remove multi-word non-quoted identifers for the IN-clause
* remove ability to change case-sensitivity comparison for IN-clause
diff --git a/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt b/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt
index 2a5a195..f8c241a 100644
--- a/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt
+++ b/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt
@@ -7,11 +7,11 @@ context !== value
context is null
context is not null
context in [value]
-context in [value1, =value2]
-context in [=value1, value2, value3]
+context in [value1, value2]
+context in [value1, value2, value3]
context not in [value]
-context not in [value1, =value2]
-context not in [=value1, value2, value3]
+context not in [value1, value2]
+context not in [value1, value2, value3]
# simple term, all operators, quoted value
context = 'quoted value'
@@ -21,19 +21,11 @@ context !== 'quoted value'
context is null
context is not null
context in ['quoted value1']
-context in ['quoted value1', ='quoted value2']
-context in [='quoted value1', 'quoted value2', 'quoted value3']
+context in ['quoted value1', 'quoted value2']
+context in ['quoted value1', 'quoted value2', 'quoted value3']
context not in ['quoted value1']
-context not in ['quoted value1', ='quoted value2']
-context not in [='quoted value1', 'quoted value2', 'quoted value3']
-
-# simple term, 'in' operator, non-quoted but multi-word values
-context in [quoted value1]
-context in [quoted value1, =quoted value2]
-context in [=quoted value1, quoted value2, quoted value3]
-context not in [quoted value1]
-context not in [quoted value1, =quoted value2]
-context not in [=quoted value1, quoted value2, quoted value3]
+context not in ['quoted value1', 'quoted value2']
+context not in ['quoted value1', 'quoted value2', 'quoted value3']
# parameterized term, all operators
context[param] = value
@@ -43,11 +35,11 @@ context[param] !== value
context[param] is null
context[param] is not null
context[param] in [value]
-context[param] in [value1, =value2]
-context[param] in [=value1, value2, value3]
+context[param] in [value1, value2]
+context[param] in [value1, value2, value3]
context[param] not in [value]
-context[param] not in [value1, =value2]
-context[param] not in [=value1, value2, value3]
+context[param] not in [value1, value2]
+context[param] not in [value1, value2, value3]
# deeply nested parenthetical simple terms
((context = value))
@@ -63,11 +55,11 @@ context[param] not in [=value1, value2, value3]
(context is null)
(context is not null)
(context in [value])
-(context in [value1, =value2])
-(context in [=value1, value2, value3])
+(context in [value1, value2])
+(context in [value1, value2, value3])
(context not in [value])
-(context not in [value1, =value2])
-(context not in [=value1, value2, value3])
+(context not in [value1, value2])
+(context not in [value1, value2, value3])
# parameterized parenthetical term, all operators
(context[param] = value)
@@ -77,11 +69,11 @@ context[param] not in [=value1, value2, value3]
(context[param] is null)
(context[param] is not null)
(context[param] in [value])
-(context[param] in [value1, =value2])
-(context[param] in [=value1, value2, value3])
+(context[param] in [value1, value2])
+(context[param] in [value1, value2, value3])
(context[param] not in [value])
-(context[param] not in [value1, =value2])
-(context[param] not in [=value1, value2, value3])
+(context[param] not in [value1, value2])
+(context[param] not in [value1, value2, value3])
# single-pair parenthetical combinations
@@ -131,4 +123,4 @@ context = value1 and ((context = value2))
((context = value1)) context = value2
(context = value1) (context = value2)
(context = value1 (context = value2))
-context = value1 ((context1 = value2))
\ No newline at end of file
+context = value1 ((context = value2))
\ No newline at end of file
commit 8a0951a835997a2cdc75d2cf9840a7a7fdf59c15
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 26 17:57:56 2010 +0100
BZ 568544 - disambiguation doesn't get confused if more than one item in the provided results corresponds to a signle resource.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
index 67f3276..dd359da 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/composite/DisambiguationReport.java
@@ -64,6 +64,6 @@ public class DisambiguationReport<T> implements Serializable {
}
public String toString() {
- return "DisambiguationReport(type=" + resourceTypeName + ", plugin=" + resourceTypePluginName + ", parents=" + parents + ")";
+ return "DisambiguationReport(type=" + resourceTypeName + ", plugin=" + resourceTypePluginName + ", parents=" + parents + ", original=" + original + ")";
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 3af7a35..e5684d2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -31,6 +31,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -2170,34 +2171,36 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
false);
}
- //this will contain the disambiguated results
- List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(results.size());
boolean typeResolutionNeeded = false;
boolean pluginResolutionNeeded = false;
boolean parentResolutionNeeded = false;
//we can't assume the ordering of the provided results and the disambiguation query results
- //will be the same, hence this map.
- Map<Integer, MutableDisambiguationReport<T>> reportByResourceId = new HashMap<Integer, MutableDisambiguationReport<T>>();
+ //will be the same.
+
+ //this list contains the resulting reports in the same order as the original results
+ List<MutableDisambiguationReport<T>> reports = new ArrayList<MutableDisambiguationReport<T>>(results.size());
+
+ //this maps the reports to resourceIds. More than one report can correspond to a single
+ //resource id. The reports in this map are the same instances as in the reports list.
+ Map<Integer, List<MutableDisambiguationReport<T>>> reportsByResourceId = new HashMap<Integer, List<MutableDisambiguationReport<T>>>();
for (T r : results) {
MutableDisambiguationReport<T> value = new MutableDisambiguationReport<T>();
value.original = r;
int resourceId = extractor.extract(r);
if (resourceId > 0) {
- reportByResourceId.put(resourceId, value);
+ List<MutableDisambiguationReport<T>> correspondingResults = reportsByResourceId.get(resourceId);
+ if (correspondingResults == null) {
+ correspondingResults = new ArrayList<MutableDisambiguationReport<T>>();
+ reportsByResourceId.put(resourceId, correspondingResults);
+ }
+ correspondingResults.add(value);
}
+ reports.add(value);
}
//check that we still have something to disambiguate
- if (reportByResourceId.isEmpty()) {
- //no, we don't. construct the resolution only using the results.
-
- for (T result : results) {
- DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections
- .<ResourceParentFlyweight> emptyList(), null, null);
- resolution.add(report);
- }
- } else {
+ if (reportsByResourceId.size() > 0) {
//first find out how many ancestors we are going to require to disambiguate the resuls
String query = Resource.NATIVE_QUERY_FIND_DISAMBIGUATION_LEVEL;
@@ -2247,7 +2250,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
Query parentsQuery = entityManager.createQuery(selectBuilder.append(" ").append(fromBuilder).toString());
- parentsQuery.setParameter("resourceIds", reportByResourceId.keySet());
+ parentsQuery.setParameter("resourceIds", reportsByResourceId.keySet());
@SuppressWarnings("unchecked")
List<Object[]> parentsResults = (List<Object[]>) parentsQuery.getResultList();
@@ -2264,28 +2267,22 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
String parentName = (String) parentsResult[2 * i + 2];
parents.add(new ResourceParentFlyweight(parentId, parentName));
}
- MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
- report.typeName = typeName;
- report.pluginName = pluginName;
- report.parents = parents;
- }
-
- //now we have all the information to create the result.
- for (T result : results) {
- int resourceId = extractor.extract(result);
- if (resourceId > 0) {
- //this results was disambiguated by the query above...
- MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
- resolution.add(report.getReport());
- } else {
- //this result doesn't correspond to any resource, need to handle it specially
- DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections
- .<ResourceParentFlyweight> emptyList(), null, null);
- resolution.add(report);
+
+ //update all the reports that correspond to this resourceId
+ for(MutableDisambiguationReport<T> report : reportsByResourceId.get(resourceId)) {
+ report.typeName = typeName;
+ report.pluginName = pluginName;
+ report.parents = parents;
}
}
}
+ List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(results.size());
+
+ for (MutableDisambiguationReport<T> report : reports) {
+ resolution.add(report.getReport());
+ }
+
return new ResourceNamesDisambiguationResult<T>(resolution, typeResolutionNeeded, parentResolutionNeeded,
pluginResolutionNeeded);
}
@@ -2297,7 +2294,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
public List<ResourceParentFlyweight> parents;
public DisambiguationReport<T> getReport() {
- return new DisambiguationReport<T>(original, parents, typeName, pluginName);
+ return new DisambiguationReport<T>(original, parents == null ? Collections
+ .<ResourceParentFlyweight> emptyList() : parents, typeName, pluginName);
}
}
}
commit b2f7c0e76fc8bd366bb58bda3250b75cf6f7ecca
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 26 12:51:53 2010 +0100
BZ 565626 - fixing the URL query string for groups used in menu search.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
index a5bd861..6a837c9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
@@ -164,7 +164,7 @@ public class ResourceGroupComposite implements Serializable {
* @return query string snippet that can appear after the "?" in group URLs.
*/
public String getGroupQueryString() {
- return "category=" + getCategory().getName() + "&groupId=" + getResourceGroup().getId();
+ return "groupId=" + getResourceGroup().getId();
}
private String getAlignedAvailabilityResults(long up, long down) {
commit f944f3d58c4d7719ea075429faa1dc938737ecf1
Author: James Livingston <jlivings(a)redhat.com>
Date: Fri Feb 26 10:53:48 2010 +0100
BZ 560859 - Add mechanism to enable/disable alert definitions for multiple resources
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
index 5831f3e..2e8d49c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2010 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -73,13 +73,13 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
private SelectItem[] categoryFilterItems;
private IntExtractor<AlertDefinitionComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<AlertDefinitionComposite>() {
-
+
public int extract(AlertDefinitionComposite object) {
Resource resource = object.getAlertDefinition().getResource();
return resource == null ? 0 : resource.getId();
}
};
-
+
public SubsystemAlertDefinitionUIBean() {
datePattern = EnterpriseFacesContextUtility.getWebUser().getWebPreferences().getDateTimeDisplayPreferences()
.getDateTimeFormatTrigger();
@@ -178,6 +178,84 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
return "success";
}
+ public String disableSelected() {
+ Integer[] selected = getSelectedItems();
+
+ try {
+ Subject subject = getSubject();
+
+ List<Integer> resourceDefinitions = new ArrayList<Integer>();
+ List<Integer> groupDefinitions = new ArrayList<Integer>();
+ List<Integer> typeDefinitions = new ArrayList<Integer>();
+
+ for (Integer definitionId : selected) {
+ if (alertDefinitionManager.isTemplate(definitionId)) {
+ typeDefinitions.add(definitionId);
+ } else if (alertDefinitionManager.isGroupAlertDefinition(definitionId)) {
+ groupDefinitions.add(definitionId);
+ } else {
+ resourceDefinitions.add(definitionId);
+ }
+ }
+
+ // delete resources first
+ alertDefinitionManager.disableAlertDefinitions(subject, resourceDefinitions
+ .toArray(new Integer[resourceDefinitions.size()]));
+
+ // then delete templates and group alert defs, which are both tolerant of missing child definitions
+ groupAlertDefinitionManager.disableGroupAlertDefinitions(subject, groupDefinitions
+ .toArray(new Integer[groupDefinitions.size()]));
+ alertTemplateManager.removeAlertTemplates(subject, typeDefinitions.toArray(new Integer[typeDefinitions
+ .size()]));
+
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Disable selected alert definitions.");
+ } catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to disable selected alert definitions.",
+ e);
+ }
+
+ return "success";
+ }
+
+ public String enableSelected() {
+ Integer[] selected = getSelectedItems();
+
+ try {
+ Subject subject = getSubject();
+
+ List<Integer> resourceDefinitions = new ArrayList<Integer>();
+ List<Integer> groupDefinitions = new ArrayList<Integer>();
+ List<Integer> typeDefinitions = new ArrayList<Integer>();
+
+ for (Integer definitionId : selected) {
+ if (alertDefinitionManager.isTemplate(definitionId)) {
+ typeDefinitions.add(definitionId);
+ } else if (alertDefinitionManager.isGroupAlertDefinition(definitionId)) {
+ groupDefinitions.add(definitionId);
+ } else {
+ resourceDefinitions.add(definitionId);
+ }
+ }
+
+ // delete resources first
+ alertDefinitionManager.enableAlertDefinitions(subject, resourceDefinitions
+ .toArray(new Integer[resourceDefinitions.size()]));
+
+ // then delete templates and group alert defs, which are both tolerant of missing child definitions
+ groupAlertDefinitionManager.enableGroupAlertDefinitions(subject, groupDefinitions
+ .toArray(new Integer[groupDefinitions.size()]));
+ alertTemplateManager.removeAlertTemplates(subject, typeDefinitions.toArray(new Integer[typeDefinitions
+ .size()]));
+
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Enable selected alert definitions.");
+ } catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to enable selected alert definitions.",
+ e);
+ }
+
+ return "success";
+ }
+
@Override
public DataModel getDataModel() {
if (dataModel == null) {
@@ -229,7 +307,7 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
protected IntExtractor<AlertDefinitionComposite> getResourceIdExtractor() {
return RESOURCE_ID_EXTRACTOR;
}
-
+
private void getDataFromRequest() {
SubsystemAlertDefinitionUIBean outer = SubsystemAlertDefinitionUIBean.this;
outer.resourceFilter = FacesContextUtility.getOptionalRequestParameter(FORM_PREFIX + "resourceFilter");
@@ -255,4 +333,4 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
return null;
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
index 2cc9a52..a1caee7 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
@@ -189,7 +189,7 @@
<f:param name="ad" value="#{item.original.alertDefinition.parentId}"/>
<h:outputText value="View Template" />
</h:outputLink>
-
+
<h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.groupAlertDefinition}">
<f:param name="mode" value="viewRoles"/>
<f:param name="groupId" value="#{item.original.alertDefinition.groupAlertDefinition.resourceGroup.id}"/>
@@ -197,8 +197,8 @@
<f:param name="ad" value="#{item.original.alertDefinition.groupAlertDefinition.id}"/>
<h:outputText value="View Group Definition" />
</h:outputLink>
-
- <h:outputText value="N/A"
+
+ <h:outputText value="N/A"
rendered="#{item.original.alertDefinition.parentId eq 0 and empty item.original.alertDefinition.groupAlertDefinition}" />
</rich:column>
@@ -208,6 +208,12 @@
<onc:selectCommandButton action="#{SubsystemAlertDefinitionUIBean.deleteSelected}"
value="DELETE SELECTED" target="selectedItems" styleClass="on-pager-button buttonsmall"
rendered="#{GlobalPermissionsUIBean.superuser}" />
+ <onc:selectCommandButton action="#{SubsystemAlertDefinitionUIBean.disableSelected}"
+ value="DISABLE SELECTED" target="selectedItems" styleClass="on-pager-button buttonsmall"
+ rendered="#{GlobalPermissionsUIBean.superuser}" />
+ <onc:selectCommandButton action="#{SubsystemAlertDefinitionUIBean.enableSelected}"
+ value="ENABLE SELECTED" target="selectedItems" styleClass="on-pager-button buttonsmall"
+ rendered="#{GlobalPermissionsUIBean.superuser}" />
<ui:param name="paginationDataTableName" value="alertDefinitionDataTable"/>
<ui:param name="paginationDataModel" value="#{alertDefinitionDataModel}"/>
commit c06cf9c470abf7d8c1bfff7b9969ce68de607105
Author: Justin Harris <jharris(a)redhat.com>
Date: Thu Feb 25 16:28:03 2010 -0500
BZ 562816 - Fixed lazy init excepion by going through entity manager directly instead of using the alert definition manager.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
index f3d97c3..b0d92d4 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
@@ -22,21 +22,15 @@ package org.rhq.enterprise.gui.alert;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+import javax.persistence.EntityManager;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.log.Log;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
-import org.rhq.enterprise.server.alert.AlertDefinitionUpdateException;
-import org.rhq.enterprise.server.alert.InvalidAlertDefinitionException;
/**
*
@@ -46,18 +40,12 @@ import org.rhq.enterprise.server.alert.InvalidAlertDefinitionException;
@Name("alertUIBean")
public class AlertUIBean implements Serializable {
- @Logger
- private Log log;
- @In("#{webUser.subject}")
- private Subject subject;
- @In
- private FacesMessages facesMessages;
@In
private AlertDescriber alertDescriber;
@In
- private AlertDefinitionManagerLocal alertDefinitionManager;
- @In
private AlertDefinition alertDefinition;
+ @In
+ private EntityManager entityManager;
private List<String> alertConditions;
private String alertDampening;
@@ -78,16 +66,8 @@ public class AlertUIBean implements Serializable {
}
public String saveAlertDefinition() {
- try {
- alertDefinitionManager.updateAlertDefinition(this.subject,
- this.alertDefinition.getId(), this.alertDefinition, false);
- } catch (InvalidAlertDefinitionException e) {
- facesMessages.add("There was an error finding the requested alert definition.");
- log.error("Invalid alert definition: " + this.alertDefinition.toSimpleString(), e);
- } catch (AlertDefinitionUpdateException e) {
- facesMessages.add("There was an error updating the definition for " + this.alertDefinition.getName());
- log.error("Error updating alert definition: " + this.alertDefinition.toSimpleString(), e);
- }
+ AlertDefinition def = entityManager.merge(this.alertDefinition);
+ entityManager.persist(def);
return null;
}
commit 602b8780654df9298dc36f6e8523e2ebb3e0c906
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 25 12:34:39 2010 -0500
add missing @WebMethod annotation to saved search manager remote interface
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
index ffd4255..231167e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
@@ -112,6 +112,7 @@ public interface SavedSearchManagerRemote {
* @return the {@link PageList} of {@link SavedSearch} entities that match the criteria filters, an empty list
* will be returned if no results were found or none matches the given filters
*/
+ @WebMethod
public PageList<SavedSearch> findSavedSearchesByCriteria( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "criteria") SavedSearchCriteria criteria);
commit 2a18d950b525c722a947803b158bc885d82ecec6
Author: Justin Harris <jharris(a)redhat.com>
Date: Thu Feb 25 12:24:48 2010 -0500
Changing ui:composition to ui:decorate to get page title working properly.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 2e9cc8b..eec04d4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -27,7 +27,7 @@
</c:otherwise>
</c:choose>
- <ui:composition template="/rhq/layout/main.xhtml">
+ <ui:decorate template="/rhq/layout/main.xhtml">
<ui:param name="pageTitle" value="#{title}"/>
@@ -272,5 +272,5 @@
</rich:modalPanel>
</ui:define>
- </ui:composition>
+ </ui:decorate>
</html>
commit f3d2b483a01c8771e106c407f4af8473bb1e61fb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 25 17:11:43 2010 +0100
BZ 535432 suppress 'null' is the condition has no name, which is the case for availability.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index c21bf21..0f48f9e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -907,7 +907,8 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
builder.append(condition.getName()).append(' ');
}
} else {
- builder.append(condition.getName()).append(' ');
+ if (category.getName()!=null) // this is null for e.g. availability
+ builder.append(condition.getName()).append(' ');
}
// next format the RHS
commit 95ab39239a9d3d2f4081a49c8edcdc51acdacbfc
Merge: c8338b8... 3705350...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 25 14:31:21 2010 +0100
Merge branch 'master' into alertPlugin
commit 37053500c05ec42b23740e4612899f2c56a21864
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 25 11:27:51 2010 +0100
BZ 568275 - add commons-codec which is needed with commons-httpclient 3
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 58087fa..06ae2ae 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -33,6 +33,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.0.1</version>
</dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
@@ -58,6 +63,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.0.1</version>
</artifactItem>
+ <artifactItem>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.2</version>
+ </artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
</configuration>
@@ -202,13 +212,13 @@
<id>deploy-jar-meta-inf</id>
<phase>package</phase>
<configuration>
- <tasks>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
<echo>*** Updating META-INF dir in ${deployment.file}...</echo>
<unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
<patternset><include name="META-INF/**" /></patternset>
</unjar>
- <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
</jar>
</tasks>
</configuration>
@@ -216,7 +226,7 @@
<goal>run</goal>
</goals>
</execution>
-
+
<execution>
<id>undeploy</id>
<phase>clean</phase>
commit b32fab5ccf90e3f6bc5c9c16e78daeb069f62675
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 25 10:59:56 2010 +0100
Persisting a new resource is no error ...
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 6755733..3af7a35 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -188,7 +188,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
entityManager.persist(resource);
- log.error("********* resource persisted ************");
+ log.debug("********* resource persisted ************");
// Execute sub-methods as overlord to bypass additional security checks.
Subject overlord = this.subjectManager.getOverlord();
updateImplicitMembership(overlord, resource);
@@ -366,7 +366,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
PluginConfigurationUpdate.QUERY_DELETE_BY_RESOURCES_0,
PluginConfigurationUpdate.QUERY_DELETE_BY_RESOURCES_1, // first delete the config objects
PluginConfigurationUpdate.QUERY_DELETE_BY_RESOURCES_2, // then the history objects wrapping those configs
- AlertConditionLog.QUERY_DELETE_BY_RESOURCES, // Don't
+ AlertConditionLog.QUERY_DELETE_BY_RESOURCES, // Don't
AlertNotificationLog.QUERY_DELETE_BY_RESOURCES, // alter
Alert.QUERY_DELETE_BY_RESOURCES, // order
AlertCondition.QUERY_DELETE_BY_RESOURCES, // of
@@ -2134,7 +2134,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
parent = null;
break;
}
-
+
} while (parent != null);
if (resource != null) {
if (!authorizationManager.canViewResource(subject, resource.getId())) {
@@ -2164,7 +2164,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
public <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwaysIncludeParent,
IntExtractor<? super T> extractor) {
-
+
if (results.isEmpty()) {
return new ResourceNamesDisambiguationResult<T>(new ArrayList<DisambiguationReport<T>>(), false, false,
false);
commit 07a482e999b87952b9cdbd2573fe6b04c4b8ff8e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Feb 24 22:04:30 2010 -0500
abstract RHQL grammar support:
* initial combined lexer/parser grammar file
* test harness to verify grammar correctness
* 100 acceptance test cases exercising all major parts of generic syntax
diff --git a/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g b/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g
new file mode 100644
index 0000000..00a0dab
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/antlr3/org/rhq/enterprise/server/search/RHQL.g
@@ -0,0 +1,137 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/*
+ * Antlr v3 grammar file to parse RHQL search expressions.
+ *
+ * @author Joseph Marques
+ */
+grammar RHQL;
+
+options {
+ language=Java;
+ backtrack=true;
+ memoize=true;
+}
+
+@header {
+ package org.rhq.enterprise.server.search;
+}
+@lexer::header {
+ package org.rhq.enterprise.server.search;
+}
+
+/*
+ * parser rules
+ */
+
+searchExpression
+ : conditionalExpression
+ ;
+
+conditionalExpression
+ : conditionalFactor ( 'or' conditionalFactor )*
+ ;
+
+conditionalFactor
+ : conditionalPrimary ( ( 'and' )? conditionalPrimary )*
+ ;
+
+conditionalPrimary
+ : simpleConditionalExpression
+ | '(' conditionalExpression ')'
+ ;
+
+simpleConditionalExpression
+ : comparisonConditionalExpression
+ | nullComparisonConditionalExpression
+ | inExpression
+ ;
+
+comparisonConditionalExpression
+ : context comparisonOperator identifier
+ ;
+
+nullComparisonConditionalExpression
+ : context nullOperator
+ ;
+
+inExpression
+ : context inOperator '[' '='? identifier ( ',' '='? identifier )* ']'
+ ;
+
+context
+ : ( lineage '.' )? path ( '[' identifier ']' )?
+ ;
+
+lineage
+ : path ( '(' INT ')' )?
+ ;
+
+path
+ : ID+
+ ;
+
+identifier
+ : quotedValue
+ | value
+ ;
+
+quotedValue
+ : '\'' ~('\'')* '\''
+ ;
+
+value
+ : ~('\'') ~(']'|','|')')*
+ ;
+
+comparisonOperator
+ : '='
+ | '=='
+ | '!='
+ | '!=='
+ ;
+
+nullOperator
+ : 'is' 'not'? 'null'
+ ;
+
+inOperator
+ : 'not'? 'in'
+ ;
+
+/*
+ * lexical elements
+ */
+
+ID
+ : 'a'..'z'
+ ;
+
+INT
+ : '0'..'9'
+ ;
+
+WS
+ : ( ' ' | '\n' | '\r' )+ { $channel = HIDDEN; }
+ ;
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt b/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt
new file mode 100644
index 0000000..2a5a195
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/resources/single-line-rhql.txt
@@ -0,0 +1,134 @@
+
+# simple term, all operators
+context = value
+context == value
+context != value
+context !== value
+context is null
+context is not null
+context in [value]
+context in [value1, =value2]
+context in [=value1, value2, value3]
+context not in [value]
+context not in [value1, =value2]
+context not in [=value1, value2, value3]
+
+# simple term, all operators, quoted value
+context = 'quoted value'
+context == 'quoted value'
+context != 'quoted value'
+context !== 'quoted value'
+context is null
+context is not null
+context in ['quoted value1']
+context in ['quoted value1', ='quoted value2']
+context in [='quoted value1', 'quoted value2', 'quoted value3']
+context not in ['quoted value1']
+context not in ['quoted value1', ='quoted value2']
+context not in [='quoted value1', 'quoted value2', 'quoted value3']
+
+# simple term, 'in' operator, non-quoted but multi-word values
+context in [quoted value1]
+context in [quoted value1, =quoted value2]
+context in [=quoted value1, quoted value2, quoted value3]
+context not in [quoted value1]
+context not in [quoted value1, =quoted value2]
+context not in [=quoted value1, quoted value2, quoted value3]
+
+# parameterized term, all operators
+context[param] = value
+context[param] == value
+context[param] != value
+context[param] !== value
+context[param] is null
+context[param] is not null
+context[param] in [value]
+context[param] in [value1, =value2]
+context[param] in [=value1, value2, value3]
+context[param] not in [value]
+context[param] not in [value1, =value2]
+context[param] not in [=value1, value2, value3]
+
+# deeply nested parenthetical simple terms
+((context = value))
+(((context = value)))
+((((context = value))))
+(((((context = value)))))
+
+# simple parenthetical term, all operators
+(context = value)
+(context == value)
+(context != value)
+(context !== value)
+(context is null)
+(context is not null)
+(context in [value])
+(context in [value1, =value2])
+(context in [=value1, value2, value3])
+(context not in [value])
+(context not in [value1, =value2])
+(context not in [=value1, value2, value3])
+
+# parameterized parenthetical term, all operators
+(context[param] = value)
+(context[param] == value)
+(context[param] != value)
+(context[param] !== value)
+(context[param] is null)
+(context[param] is not null)
+(context[param] in [value])
+(context[param] in [value1, =value2])
+(context[param] in [=value1, value2, value3])
+(context[param] not in [value])
+(context[param] not in [value1, =value2])
+(context[param] not in [=value1, value2, value3])
+
+
+# single-pair parenthetical combinations
+# simple expression, 'or' boolean operator
+context = value1 or context = value2
+(context = value1) or context = value2
+context = value1 or (context = value2)
+(context = value1) or (context = value2)
+
+# single-pair parenthetical combinations
+# simple expression, 'and' boolean operator
+context = value and context = value
+(context = value) and context = value
+context = value and (context = value)
+(context = value) and (context = value)
+
+# single-pair parenthetical combinations
+# simple expression, no boolean operator (implies 'and' semantics)
+context = value context = value
+(context = value) context = value
+context = value (context = value)
+(context = value) (context = value)
+
+
+# double-pair parenthetical combinations
+# simple expression, 'or' boolean operator
+((context = value1 or context = value2))
+((context = value1) or context = value2)
+((context = value1)) or context = value2
+(context = value1) or (context = value2)
+(context = value1 or (context = value2))
+context = value1 or ((context = value2))
+
+# double-pair parenthetical combinations
+# simple expression, 'and' boolean operator
+((context = value1 and context = value2))
+((context = value1) and context = value2)
+((context = value1)) and context = value2
+(context = value1) and (context = value2)
+(context = value1 and (context = value2))
+context = value1 and ((context = value2))
+
+# double-pair parenthetical combinations
+# simple expression, no boolean operator (implies 'and' semantics)
+((context = value1 context = value2))
+((context = value1) context = value2)
+((context = value1)) context = value2
+(context = value1) (context = value2)
+(context = value1 (context = value2))
+context = value1 ((context1 = value2))
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java
new file mode 100644
index 0000000..637e339
--- /dev/null
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/search/RHQLTest.java
@@ -0,0 +1,170 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.server.search;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+/**
+ * Test harness to verify correctness of RHQL grammar
+ *
+ * @author Joseph Marques
+ */
+public class RHQLTest extends AssertJUnit {
+
+ private enum TestResult {
+ SUCCESS, FAILURE, TIMEOUT, SKIPPED;
+ }
+
+ private class AntlrTask implements Callable<TestResult> {
+ private String line;
+
+ public AntlrTask(String line) {
+ this.line = line;
+ }
+
+ @Override
+ public TestResult call() throws Exception {
+ try {
+ ANTLRStringStream input = new ANTLRStringStream(line); // Create an input character stream from standard in
+ RHQLLexer lexer = new RHQLLexer(input); // Create an echoLexer that feeds from that stream
+ CommonTokenStream tokens = new CommonTokenStream(lexer); // Create a stream of tokens fed by the lexer
+ RHQLParser parser = new RHQLParser(tokens); // Create a parser that feeds off the token stream
+ parser.searchExpression(); // Begin parsing at 'searchExpression' rule
+ return TestResult.SUCCESS;
+ } catch (Throwable t) {
+ return TestResult.FAILURE;
+ }
+ }
+ };
+
+ private ExecutorService executor;
+
+ @BeforeSuite
+ public void init() {
+ executor = Executors.newSingleThreadExecutor();
+ }
+
+ @AfterSuite
+ public void teardown() {
+ executor.shutdownNow();
+ }
+
+ @Test
+ public void testSingleLineRHQL() throws Exception {
+ BufferedReader reader = null;
+ List<String> successes = new java.util.ArrayList<String>();
+ List<String> failures = new java.util.ArrayList<String>();
+ int count = 0;
+ try {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("single-line-rhql.txt");
+ reader = new BufferedReader(new InputStreamReader(stream));
+ String line = null;
+ long timeout = 2000;
+ while ((line = reader.readLine()) != null) {
+ TestResult result = testSuccess(line, timeout);
+ if (result == TestResult.SKIPPED) {
+ continue;
+ }
+ count++;
+ if (result == TestResult.SUCCESS) {
+ successes.add(line);
+ } else if (result == TestResult.FAILURE) {
+ failures.add(line);
+ } else if (result == TestResult.TIMEOUT) {
+ System.out.println("Parsing took more than " + timeout
+ + "ms, does your grammar have an infinite loop?");
+ }
+ }
+ } catch (Exception e) {
+ System.out.println("Error testing single line RHQL: " + e);
+ throw e;
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+
+ System.out.println();
+ for (String success : successes) {
+ System.out.println("Parse success: " + success);
+ }
+ for (String failure : failures) {
+ System.out.println("Parse failure: " + failure);
+ }
+
+ System.out.println();
+ System.out.printf("RHQL expressions parsed: %1$s, Failures: %2$s", count, failures.size());
+ System.out.println();
+
+ assert failures.size() == 0;
+ }
+
+ private TestResult testSuccess(final String line, long timeout) {
+ if (shouldSkip(line)) {
+ return TestResult.SKIPPED; // skip empty lines used for visual separation in test file
+ }
+
+ AntlrTask task = new AntlrTask(line);
+ Future<TestResult> futureTask = executor.submit(task);
+ TestResult result = null;
+ try {
+ result = futureTask.get(timeout, TimeUnit.MILLISECONDS);
+ } catch (ExecutionException ee) {
+ } catch (TimeoutException te) {
+ futureTask.cancel(true);
+ result = TestResult.TIMEOUT;
+ } catch (InterruptedException ie) {
+ futureTask.cancel(true);
+ }
+
+ return result;
+ }
+
+ private boolean shouldSkip(String line) {
+ line = line.trim();
+ if (line.equals("")) {
+ return true; // ignore empty lines
+ }
+ if (line.startsWith("#")) {
+ return true; // ignore comments
+ }
+ return false;
+ }
+}
commit c8338b898b50fbfe86e07d4c25cba30deb9c3139
Merge: a99099e... 4714eb8...
Author: Justin Harris <jharris(a)redhat.com>
Date: Wed Feb 24 12:24:53 2010 -0500
Merge remote branch 'origin/alertPlugin' into bugz
commit 810993311fa5e22495be1eb9cfebb154a0e3a3ef
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 24 12:21:24 2010 -0500
don't bother looping/logging if debug not enabled.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index ef27906..dd943e0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -125,8 +125,11 @@ public abstract class Criteria implements Serializable {
results.put(getCleansedFieldName(filterField, 6), filterFieldValue);
}
}
- for (Map.Entry<String, Object> entries : results.entrySet()) {
- LOG.debug("Filter: (" + entries.getKey() + ", " + entries.getValue() + ")");
+
+ if (LOG.isDebugEnabled()) {
+ for (Map.Entry<String, Object> entries : results.entrySet()) {
+ LOG.debug("Filter: (" + entries.getKey() + ", " + entries.getValue() + ")");
+ }
}
return results;
}
@@ -160,8 +163,10 @@ public abstract class Criteria implements Serializable {
}
}
}
- for (String entry : results) {
- LOG.debug("Fetch: (" + entry + ")");
+ if (LOG.isDebugEnabled()) {
+ for (String entry : results) {
+ LOG.debug("Fetch: (" + entry + ")");
+ }
}
return results;
}
@@ -283,7 +288,9 @@ public abstract class Criteria implements Serializable {
}
}
}
- LOG.debug("Page Control: " + pc);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Page Control: " + pc);
+ }
return pc;
}
commit a99099ea48d165b4a272949d2fce9e2815a3b061
Author: Justin Harris <jharris(a)redhat.com>
Date: Wed Feb 24 12:21:04 2010 -0500
Fix for BZ 561900
Adding in length and null value validation for alert definition names.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java
deleted file mode 100644
index 62a6fc0..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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.gui.alert;
-
-import java.text.MessageFormat;
-import java.util.Map;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-
-(a)Scope(ScopeType.APPLICATION)
-@Name("alertConditionMessages")
-public class AlertConditionMessages {
-
- @In
- private Map<String, String> messages;
-
- public String getThreshold() {
- return translate("errors.double", "Threshold");
- }
-
- public String getPercentRange() {
- return translate("errors.range", "Threshold", "0%", "1000%");
- }
-
- public String getDampeningCount() {
- return translate("errors.integer", "Dampening Count");
- }
-
- public String getDampeningEvaluation() {
- return translate("errors.integer", "Dampening Evaluations");
- }
-
- public String getTimePeriod() {
- return translate("errors.integer", "Time Period");
- }
-
- private String translate(String key, Object... params) {
- String message = messages.get(key);
-
- return MessageFormat.format(message, params);
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertMessages.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertMessages.java
new file mode 100644
index 0000000..79062ef
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertMessages.java
@@ -0,0 +1,70 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+(a)Scope(ScopeType.APPLICATION)
+@Name("alertMessages")
+public class AlertMessages {
+
+ @In
+ private Map<String, String> messages;
+
+ public String getNameRequired() {
+ String name = translate("alerts.config.DefinitionList.ListHeader.AlertName");
+ return translate("errors.required", name);
+ }
+
+ public String getNameLength() {
+ String name = translate("alerts.config.DefinitionList.ListHeader.AlertName");
+ return translate("errors.maxlength", name);
+ }
+
+ public String getThreshold() {
+ return translate("errors.double", "Threshold");
+ }
+
+ public String getPercentRange() {
+ return translate("errors.range", "Threshold", "0%", "1000%");
+ }
+
+ public String getDampeningCount() {
+ return translate("errors.integer", "Dampening Count");
+ }
+
+ public String getDampeningEvaluation() {
+ return translate("errors.integer", "Dampening Evaluations");
+ }
+
+ public String getTimePeriod() {
+ return translate("errors.integer", "Time Period");
+ }
+
+ private String translate(String key, Object... params) {
+ String message = messages.get(key);
+
+ return MessageFormat.format(message, params);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml
index 9439c5f..fd8e260 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml
@@ -17,7 +17,15 @@
<h:panelGrid columns="2" border="1" cellpadding="5" style="margin: 15px;">
<h:outputLabel for="alertNameInput" value="Name: " />
- <h:inputText id="alertNameInput" value="#{alertDefinition.name}" style="width: 300px;" />
+ <h:inputText id="alertNameInput"
+ value="#{alertDefinition.name}"
+ style="width: 300px;"
+ maxlength="100"
+ required="true"
+ requiredMessage="#{alertMessages.nameRequired}"
+ validatorMessage="#{alertMessages.nameLength}">
+ <f:validateLength maximum="100" />
+ </h:inputText>
<h:outputLabel for="alertDescriptionInput" value="Description: " />
<h:inputTextarea id="alertDescriptionInput" value="#{alertDefinition.description}" style="width: 300px;" />
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
index a5500e4..2000efd 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
@@ -170,9 +170,9 @@
value="#{alertDefinition.alertDampening.value}"
size="4"
required="true"
- requiredMessage="#{alertConditionMessages.dampeningCount}"
- validatorMessage="#{alertConditionMessages.dampeningCount}"
- converterMessage="#{alertConditionMessages.dampeningCount}">
+ requiredMessage="#{alertMessages.dampeningCount}"
+ validatorMessage="#{alertMessages.dampeningCount}"
+ converterMessage="#{alertMessages.dampeningCount}">
<f:validateDoubleRange minimum="0" />
</h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenConsecutiveCount.2']}" />
@@ -184,9 +184,9 @@
value="#{alertDefinition.alertDampening.value}"
size="4"
required="true"
- requiredMessage="#{alertConditionMessages.dampeningCount}"
- validatorMessage="#{alertConditionMessages.dampeningCount}"
- converterMessage="#{alertConditionMessages.dampeningCount}">
+ requiredMessage="#{alertMessages.dampeningCount}"
+ validatorMessage="#{alertMessages.dampeningCount}"
+ converterMessage="#{alertMessages.dampeningCount}">
<f:validateLongRange minimum="0" />
</h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.2']} " />
@@ -194,9 +194,9 @@
value="#{alertDefinition.alertDampening.period}"
size="4"
required="true"
- requiredMessage="#{alertConditionMessages.dampeningEvaluation}"
- validatorMessage="#{alertConditionMessages.dampeningEvaluation}"
- converterMessage="#{alertConditionMessages.dampeningEvaluation}">
+ requiredMessage="#{alertMessages.dampeningEvaluation}"
+ validatorMessage="#{alertMessages.dampeningEvaluation}"
+ converterMessage="#{alertMessages.dampeningEvaluation}">
<f:validateLongRange minimum="0" />
</h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.3']}" />
@@ -208,9 +208,9 @@
value="#{alertDefinition.alertDampening.value}"
size="4"
required="true"
- requiredMessage="#{alertConditionMessages.dampeningCount}"
- validatorMessage="#{alertConditionMessages.dampeningCount}"
- converterMessage="#{alertConditionMessages.dampeningCount}">
+ requiredMessage="#{alertMessages.dampeningCount}"
+ validatorMessage="#{alertMessages.dampeningCount}"
+ converterMessage="#{alertMessages.dampeningCount}">
<f:validateLongRange minimum="0" />
</h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenDurationCount.2']} " />
@@ -218,9 +218,9 @@
value="#{alertDefinition.alertDampening.period}"
size="4"
required="true"
- requiredMessage="#{alertConditionMessages.timePeriod}"
- validatorMessage="#{alertConditionMessages.timePeriod}"
- converterMessage="#{alertConditionMessages.timePeriod}">
+ requiredMessage="#{alertMessages.timePeriod}"
+ validatorMessage="#{alertMessages.timePeriod}"
+ converterMessage="#{alertMessages.timePeriod}">
<f:validateLongRange minimum="0" />
</h:inputText>
<h:selectOneMenu value="#{alertDefinition.alertDampening.periodUnits}">
@@ -341,8 +341,8 @@
<h:inputText id="metricThresholdAbsolute"
value="#{alertConditionsUIBean.threshold}"
required="true"
- requiredMessage="#{alertConditionMessages.threshold}"
- validatorMessage="#{alertConditionMessages.threshold}">
+ requiredMessage="#{alertMessages.threshold}"
+ validatorMessage="#{alertMessages.threshold}">
<f:validateDoubleRange minimum="0.0" />
</h:inputText>
<h:outputLabel for="metricThresholdAbsolute" value="#{messages['alert.config.props.CB.Content.AbsoluteValue']}" />
@@ -371,8 +371,8 @@
value="#{alertConditionsUIBean.currentCondition.threshold}"
converter="#{metricPercentConverter}"
required="true"
- requiredMessage="#{alertConditionMessages.percentRange}"
- validatorMessage="#{alertConditionMessages.percentRange}">
+ requiredMessage="#{alertMessages.percentRange}"
+ validatorMessage="#{alertMessages.percentRange}">
<f:validateDoubleRange minimum="0.0" maximum="1000.0" />
</h:inputText>
<h:outputLabel for="metricBaselinePercent" value=" #{messages['alert.config.props.CB.Content.Percent']} " />
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index a987e65..dd349a1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -77,8 +77,7 @@
</ui:define>
<ui:define name="body">
- <h:messages showDetail="true"
- globalOnly="true"
+ <h:messages showSummary="true"
infoClass="InfoBlock"
warnClass="WarnBlock"
errorClass="ErrorBlock"
commit 4714eb87aeeb6dce6a6ebcb7573bc80dafa3928d
Merge: e25997a... 7f4d769...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 18:19:46 2010 +0100
Merge branch 'master' into alertPlugin
commit 7f4d76951a1e2686aa4d104477765d9b4d350dad
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 24 18:13:05 2010 +0100
BZ 566749 - fixing the NPE when adding platforms (that don't have a parent) to a resource group.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
index 698cb5a..808f331 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
@@ -201,7 +201,10 @@ public class AddGroupResourcesFormPrepareAction extends Action {
Resource resource = dr.getOriginal();
Resource parent = resource.getParentResource();
- parent.setName(buildLineage(dr.getParents()));
+ //platforms don't have parents, need to check for null here
+ if (parent != null) {
+ parent.setName(buildLineage(dr.getParents()));
+ }
convertedResults.add(resource);
}
commit 38fb361e5cdb167bb5a947596586194d941e4221
Author: Justin Harris <jharris(a)redhat.com>
Date: Wed Feb 24 10:55:35 2010 -0500
Fix for BZ 567375
Changed method of resource id lookup in control describer.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
index bcf5d25..ab1bd8a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
@@ -18,9 +18,11 @@
*/
package org.rhq.enterprise.gui.alert.description;
+import org.jboss.seam.Component;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -53,12 +55,13 @@ public class ControlDescriber extends AlertConditionDescriber {
private OperationDefinition getDefinition(AlertCondition condition) {
OperationManagerLocal operationManager = LookupUtil.getOperationManager();
- Integer resourceTypeId = condition.getAlertDefinition().getResource().getResourceType().getId();
+ // this is not a seam component, so look it up in the component contexts
+ ResourceType resourceType = (ResourceType)Component.getInstance("resourceType");
String operationName = condition.getName();
try {
return operationManager.getOperationDefinitionByResourceTypeAndName(
- resourceTypeId, operationName, false);
+ resourceType.getId(), operationName, false);
} catch (Exception e) {
return null;
}
commit e25997a61a0e49e38768d20461afffb9d19a554e
Merge: 33e3625... 1e8ab54...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 16:53:45 2010 +0100
Merge branch 'master' into alertPlugin
commit 33e3625f6e4383d2bf44e832452347fc08241b97
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 16:33:43 2010 +0100
Linking fixes for BZ 566896
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
index 2e5a565..5768c23 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/alert/listGroupAlertDefinitions.xhtml
@@ -18,10 +18,10 @@
<ui:param name="pageTitle" value="List Alert Definitions for Group '#{ResourceGroupUIBean.name}'"/>
<ui:param name="selectedTabName" value="Alert.Definitions"/>
<ui:define name="content">
-
+
<h:form id="alertDefinitionsListForm">
<input type="hidden" name="groupId" value="${param.groupId}"/>
-
+
<rich:panel styleClass="BlockContent">
<f:facet name="header">
<h:outputText value="Alert Definitions"/>
@@ -48,12 +48,12 @@
<f:facet name="PageControlView">
<onc:paginationControl id="GroupAlertDefinitionsList" />
</f:facet>
-
+
<rich:column>
<f:facet name="header">
<onc:allSelect target="selectedAlertDefinitions" />
</f:facet>
-
+
<onc:select name="selectedAlertDefinitions" value="#{item.id}" />
</rich:column>
@@ -63,25 +63,24 @@
<h:outputText styleClass="headerText" value="Name" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles"/>
+
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="groupId" value="#{param.groupId}"/>
<f:param name="ad" value="#{item.id}"/>
<h:outputText value="#{item.name}" />
</h:outputLink>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.description">
<h:outputText styleClass="headerText" value="Description" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.description}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.ctime">
@@ -93,14 +92,14 @@
<f:converter converterId="UserDateTimeConverter" />
</h:outputText>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.enabled">
<h:outputText styleClass="headerText" value="Active" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.enabled}"/>
</rich:column>
@@ -134,7 +133,7 @@
</rich:dataTable>
</h:panelGrid>
-
+
</rich:panel>
</h:form>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertDefinitions.xhtml
index 708f559..ef13121 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertDefinitions.xhtml
@@ -18,10 +18,10 @@
<ui:param name="pageTitle" value="List Alert Definitions for Resource '#{ResourceUIBean.name}'"/>
<ui:param name="selectedTabName" value="Alert.Definitions"/>
<ui:define name="content">
-
+
<h:form id="alertDefinitionsListForm">
<input type="hidden" name="id" value="${param.id}"/>
-
+
<rich:panel styleClass="BlockContent">
<f:facet name="header">
<h:outputText value="Alert Definitions"/>
@@ -48,12 +48,12 @@
<f:facet name="PageControlView">
<onc:paginationControl id="AlertDefinitionsList" />
</f:facet>
-
+
<rich:column>
<f:facet name="header">
<onc:allSelect target="selectedAlertDefinitions" />
</f:facet>
-
+
<onc:select name="selectedAlertDefinitions" value="#{item.id}" />
</rich:column>
@@ -63,24 +63,24 @@
<h:outputText styleClass="headerText" value="Name" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="id" value="#{Resource.id}"/>
<f:param name="ad" value="#{item.id}"/>
<h:outputText value="#{item.name}" />
</h:outputLink>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.description">
<h:outputText styleClass="headerText" value="Description" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.description}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.ctime">
@@ -92,14 +92,14 @@
<f:converter converterId="UserDateTimeConverter" />
</h:outputText>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.enabled">
<h:outputText styleClass="headerText" value="Active" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.enabled}"/>
</rich:column>
@@ -107,15 +107,13 @@
<f:facet name="header">
<h:outputText styleClass="headerText" value="Parent" />
</f:facet>
-
- <h:outputLink value="/alerts/Config.do" rendered="#{item.parentId ne 0}">
- <f:param name="mode" value="viewRoles"/>
+
+ <h:outputLink value="http://localhost:7080/rhq/resource/alert/viewAlert.xhtml" rendered="#{item.parentId ne 0}">
<f:param name="type" value="#{item.resource.resourceType.id}"/>
- <f:param name="from" value="#{item.id}"/>
<f:param name="ad" value="#{item.parentId}"/>
<h:outputText value="View Template" />
</h:outputLink>
-
+
<h:outputLink value="/alerts/Config.do" rendered="#{not empty item.groupAlertDefinition}">
<f:param name="mode" value="viewRoles"/>
<f:param name="groupId" value="#{item.groupAlertDefinition.resourceGroup.id}"/>
@@ -129,7 +127,7 @@
<f:facet name="header">
<h:outputText styleClass="headerText" value="Read Only" />
</f:facet>
-
+
<h:outputText value="N/A" rendered="#{item.parentId eq 0 and empty item.groupAlertDefinition}"/>
<h:outputText value="#{item.readOnly}" rendered="#{item.parentId ne 0 or not empty item.groupAlertDefinition}"/>
</rich:column>
@@ -167,7 +165,7 @@
</rich:dataTable>
</h:panelGrid>
-
+
</rich:panel>
</h:form>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index a987e65..75a1d50 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -19,6 +19,9 @@
<c:when test="#{not empty param.type}">
<c:set var="title" value="Definition for '#{alertDefinition.name}' on resource type '#{ResourceTypeUIBean.name}'"/>
</c:when>
+ <c:when test="#{not empty param.groupId}">
+ <c:set var="title" value="Definition for '#{alertDefinition.name}' on group '#{ResourceGroupUIBean.name}'"/>
+ </c:when>
<c:otherwise>
<c:set var="title" value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'"/>
</c:otherwise>
@@ -55,18 +58,25 @@
<h:outputText>Alert Definitions</h:outputText>
</h:outputLink>
<h:outputText> > </h:outputText>
- <h:outputLink value="viewAlert.xhtml">
- <f:param name="ad" value="#{alertDefinition.id}" />
- <h:outputText value=" Definition for '#{alertDefinition.name}' "/>
- </h:outputLink>
<c:choose>
<c:when test="#{not empty param.type}">
- <h:outputText> on resource type </h:outputText>
+ <h:outputText value=" Definition for alert template '#{alertDefinition.name}' "/>
+ <h:outputText> on Resource Type </h:outputText>
<h:outputLink value="/rhq/admin/listAlertTemplates.xhtml?type=${param.type}">
<h:outputText value=" #{ResourceTypeUIBean.name}"/>
</h:outputLink>
</c:when>
+ <c:when test="#{not empty param.groupId}">
+ <h:outputText> on resource group </h:outputText>
+ <h:outputLink value="/rhq/group/alert/listGroupAlertDefinitions.xhtml?groupId=${param.groupId}">
+ <h:outputText value=" #{ResourceGroupUIBean.name}"/>
+ </h:outputLink>
+ </c:when>
<c:otherwise>
+ <h:outputLink value="viewAlert.xhtml">
+ <f:param name="ad" value="#{alertDefinition.id}" />
+ <h:outputText value=" Definition for '#{alertDefinition.name}' "/>
+ </h:outputLink>
<h:outputText> on resource </h:outputText>
<h:outputLink value="/rhq/resource/summary/overview.xhtml">
<f:param name="id" value="#{alertDefinition.resource.id}" />
@@ -196,6 +206,11 @@
<h:outputText value="Back to Alert Definitions for Resource Type '#{ResourceTypeUIBean.name}'"/>
</h:outputLink>
</c:when>
+ <c:when test="#{not empty param.groupId}">
+ <h:outputLink value="/rhq/group/alert/listGroupAlertDefinitions.xhtml?groupId=${param.groupId}">
+ <h:outputText value="Back to Alert Definitions for Resource Group '#{ResourceGroupUIBean.name}'"/>
+ </h:outputLink>
+ </c:when>
<c:otherwise>
<h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
<f:param name="id" value="#{alertDefinition.resource.id}"/>
commit 1e8ab544201de380a8911b2fa88701c4b9b1a206
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 24 15:33:18 2010 +0100
BZ 567925 - Restructured the ResourceManagerBean.disambiguate() method to handle (hopefully) all the corner cases resulting from the fact that not all of the provided results have to be mappable to a resource.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index b0db81c..6755733 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2162,45 +2162,23 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return (findChildResources(subject, parentResource, pageControl));
}
- public <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwaysIncludeParent, IntExtractor<? super T> extractor) {
- if (results.isEmpty()) {
- return new ResourceNamesDisambiguationResult<T>(new ArrayList<DisambiguationReport<T>>(), false, false, false);
- }
+ public <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwaysIncludeParent,
+ IntExtractor<? super T> extractor) {
- String query = Resource.NATIVE_QUERY_FIND_DISAMBIGUATION_LEVEL;
-
- query = JDBCUtil.transformQueryForMultipleInParameters(query, "@@RESOURCE_IDS@@", results.size());
- Query disambiguateQuery = entityManager.createNativeQuery(query);
- int i = 1;
- for (T r : results) {
- disambiguateQuery.setParameter(i++, extractor.extract(r));
- }
-
- Object[] rs = (Object[]) disambiguateQuery.getSingleResult();
-
- int disambiguationLevel = Resource.MAX_SUPPORTED_RESOURCE_HIERARCHY_DEPTH; //the max we support
-
- int targetCnt = ((BigInteger) rs[0]).intValue();
- int typeCnt = ((BigInteger) rs[1]).intValue();
- int typeAndPluginCnt = ((BigInteger) rs[2]).intValue();
- for (i = 1; i <= Resource.MAX_SUPPORTED_RESOURCE_HIERARCHY_DEPTH; ++i) {
- int levelCnt = ((BigInteger) rs[2 + i]).intValue();
- if (levelCnt == targetCnt) {
- disambiguationLevel = i - 1;
- break;
- }
- }
-
- if (alwaysIncludeParent && disambiguationLevel == 0) {
- disambiguationLevel = 1;
+ if (results.isEmpty()) {
+ return new ResourceNamesDisambiguationResult<T>(new ArrayList<DisambiguationReport<T>>(), false, false,
+ false);
}
- boolean typeResolutionNeeded = typeAndPluginCnt > 1;
- boolean pluginResolutionNeeded = typeAndPluginCnt > typeCnt;
- boolean parentResolutionNeeded = disambiguationLevel > 0;
+ //this will contain the disambiguated results
+ List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(results.size());
+ boolean typeResolutionNeeded = false;
+ boolean pluginResolutionNeeded = false;
+ boolean parentResolutionNeeded = false;
- //we can't assume any ordering in the results, hence this map
- Map<Integer, MutableDisambiguationReport<T>> reportByResourceId = new LinkedHashMap<Integer, MutableDisambiguationReport<T>>();
+ //we can't assume the ordering of the provided results and the disambiguation query results
+ //will be the same, hence this map.
+ Map<Integer, MutableDisambiguationReport<T>> reportByResourceId = new HashMap<Integer, MutableDisambiguationReport<T>>();
for (T r : results) {
MutableDisambiguationReport<T> value = new MutableDisambiguationReport<T>();
value.original = r;
@@ -2210,57 +2188,101 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
}
- //k, now let's construct the JPQL query to get the parents and type infos...
- StringBuilder selectBuilder = new StringBuilder("SELECT r0.id, r0.resourceType.name, r0.resourceType.plugin");
- StringBuilder fromBuilder = new StringBuilder("FROM Resource r0");
+ //check that we still have something to disambiguate
+ if (reportByResourceId.isEmpty()) {
+ //no, we don't. construct the resolution only using the results.
- for (i = 1; i <= disambiguationLevel; ++i) {
- int pi = i - 1;
- selectBuilder.append(", r").append(i).append(".id");
- selectBuilder.append(", r").append(i).append(".name");
- fromBuilder.append(" left join r").append(pi).append(".parentResource r").append(i);
- }
+ for (T result : results) {
+ DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections
+ .<ResourceParentFlyweight> emptyList(), null, null);
+ resolution.add(report);
+ }
+ } else {
+ //first find out how many ancestors we are going to require to disambiguate the resuls
+ String query = Resource.NATIVE_QUERY_FIND_DISAMBIGUATION_LEVEL;
+
+ query = JDBCUtil.transformQueryForMultipleInParameters(query, "@@RESOURCE_IDS@@", results.size());
+ Query disambiguateQuery = entityManager.createNativeQuery(query);
+ int i = 1;
+ for (T r : results) {
+ disambiguateQuery.setParameter(i++, extractor.extract(r));
+ }
- fromBuilder.append(" WHERE r0.id IN (:resourceIds)");
+ Object[] rs = (Object[]) disambiguateQuery.getSingleResult();
- Query parentsQuery = entityManager.createQuery(selectBuilder.append(" ").append(fromBuilder).toString());
+ int disambiguationLevel = Resource.MAX_SUPPORTED_RESOURCE_HIERARCHY_DEPTH; //the max we support
- parentsQuery.setParameter("resourceIds", reportByResourceId.keySet());
+ int targetCnt = ((BigInteger) rs[0]).intValue();
+ int typeCnt = ((BigInteger) rs[1]).intValue();
+ int typeAndPluginCnt = ((BigInteger) rs[2]).intValue();
+ for (i = 1; i <= Resource.MAX_SUPPORTED_RESOURCE_HIERARCHY_DEPTH; ++i) {
+ int levelCnt = ((BigInteger) rs[2 + i]).intValue();
+ if (levelCnt == targetCnt) {
+ disambiguationLevel = i - 1;
+ break;
+ }
+ }
+
+ if (alwaysIncludeParent && disambiguationLevel == 0) {
+ disambiguationLevel = 1;
+ }
- @SuppressWarnings("unchecked")
- List<Object[]> parentsResults = (List<Object[]>) parentsQuery.getResultList();
- for (Object[] parentsResult : parentsResults) {
- List<ResourceParentFlyweight> parents = new ArrayList<ResourceParentFlyweight>(disambiguationLevel);
- Integer resourceId = (Integer) parentsResult[0];
- String typeName = (String) parentsResult[1];
- String pluginName = (String) parentsResult[2];
+ typeResolutionNeeded = typeAndPluginCnt > 1;
+ pluginResolutionNeeded = typeAndPluginCnt > typeCnt;
+ parentResolutionNeeded = disambiguationLevel > 0;
+
+ //k, now let's construct the JPQL query to get the parents and type infos...
+ StringBuilder selectBuilder = new StringBuilder(
+ "SELECT r0.id, r0.resourceType.name, r0.resourceType.plugin");
+ StringBuilder fromBuilder = new StringBuilder("FROM Resource r0");
for (i = 1; i <= disambiguationLevel; ++i) {
- Integer parentId = (Integer) parentsResult[2 * i + 1];
- if (parentId == null)
- break;
- String parentName = (String) parentsResult[2 * i + 2];
- parents.add(new ResourceParentFlyweight(parentId, parentName));
+ int pi = i - 1;
+ selectBuilder.append(", r").append(i).append(".id");
+ selectBuilder.append(", r").append(i).append(".name");
+ fromBuilder.append(" left join r").append(pi).append(".parentResource r").append(i);
}
- MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
- report.typeName = typeName;
- report.pluginName = pluginName;
- report.parents = parents;
- }
- //now we have all the information to create the result.
- //first create the immutable reports.
- List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(results.size());
+ fromBuilder.append(" WHERE r0.id IN (:resourceIds)");
- for(T result : results) {
- int resourceId = extractor.extract(result);
- if (resourceId > 0) {
+ Query parentsQuery = entityManager.createQuery(selectBuilder.append(" ").append(fromBuilder).toString());
+
+ parentsQuery.setParameter("resourceIds", reportByResourceId.keySet());
+
+ @SuppressWarnings("unchecked")
+ List<Object[]> parentsResults = (List<Object[]>) parentsQuery.getResultList();
+ for (Object[] parentsResult : parentsResults) {
+ List<ResourceParentFlyweight> parents = new ArrayList<ResourceParentFlyweight>(disambiguationLevel);
+ Integer resourceId = (Integer) parentsResult[0];
+ String typeName = (String) parentsResult[1];
+ String pluginName = (String) parentsResult[2];
+
+ for (i = 1; i <= disambiguationLevel; ++i) {
+ Integer parentId = (Integer) parentsResult[2 * i + 1];
+ if (parentId == null)
+ break;
+ String parentName = (String) parentsResult[2 * i + 2];
+ parents.add(new ResourceParentFlyweight(parentId, parentName));
+ }
MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
- resolution.add(report.getReport());
- } else {
- //this result doesn't correspond to any resource, need to handle it specially
- DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections.<ResourceParentFlyweight>emptyList(), null, null);
- resolution.add(report);
+ report.typeName = typeName;
+ report.pluginName = pluginName;
+ report.parents = parents;
+ }
+
+ //now we have all the information to create the result.
+ for (T result : results) {
+ int resourceId = extractor.extract(result);
+ if (resourceId > 0) {
+ //this results was disambiguated by the query above...
+ MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
+ resolution.add(report.getReport());
+ } else {
+ //this result doesn't correspond to any resource, need to handle it specially
+ DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections
+ .<ResourceParentFlyweight> emptyList(), null, null);
+ resolution.add(report);
+ }
}
}
commit 2b28eb953aad5656ce7c7ecf6eaf029e767b27a9
Merge: 40bfa51... 7b5ccc1...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 13:48:36 2010 +0100
Merge branch 'master' into alertPlugin
commit 40bfa515fa1c5dcc785e80597505f43866dd399c
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 13:46:00 2010 +0100
Provide an internal cleanup method that is called when the notification is deleted. This way, the backing bean can do some housekeeping if needed.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
index dfa59f3..0896c6e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.NotificationTemplate;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
-import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.plugin.PluginKey;
@@ -154,6 +153,18 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
}
}
+ // Before we delete the notification, check if has a custom backing bean
+ // and give it the possibility to clean up
+ for (AlertNotification notification : toBeRemoved) {
+ CustomAlertSenderBackingBean bb = getBackingBeanForSender(notification.getSenderName(),notification.getId());
+ try {
+ bb.internalCleanup();
+ }
+ catch (Throwable t ) {
+ LOG.error("removeNotifications, calling backingBean.internalCleanup() resulted in " + t.getMessage());
+ }
+ }
+
alertDefinition.getAlertNotifications().removeAll(toBeRemoved);
postProcessAlertDefinition(alertDefinition);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index 5b39eae..e4b2d20 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -44,7 +44,7 @@ public class CustomAlertSenderBackingBean {
* This method is called when the alert notification that uses this backing bean
* is removed, so that the backing bean can do some cleanup work
*/
- protected void cleanup() {}
+ public void internalCleanup() {}
/**
* Persist the passed configuration object. This can be a new object or one
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
index 2a3b635..98fa0e9 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.server.plugins.alertOperations;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -71,6 +72,17 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
log.info("init");
}
+ @Override
+ public void internalCleanup() {
+ PropertySimple parameterConfigProp = alertParameters.getSimple(OperationsSender.PARAMETERS_CONFIG);
+ if (parameterConfigProp!=null) {
+ Integer paramId = parameterConfigProp.getIntegerValue();
+ if (paramId!=null) {
+ ConfigurationManagerLocal cmgr = LookupUtil.getConfigurationManager();
+ cmgr.deleteConfigurations(Arrays.asList(paramId));
+ }
+ }
+ }
public String selectResource() {
commit 780776f1eaf8067d86fa2ca45354fc5686f9d9c5
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 24 13:33:37 2010 +0100
Add a link to re-enable the definition on the detail page. Alternate solution to BZ 535889
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ReenableAlertDefinitionAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ReenableAlertDefinitionAction.java
new file mode 100644
index 0000000..265db09
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ReenableAlertDefinitionAction.java
@@ -0,0 +1,80 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.legacy.action.resource.common.monitor.alerts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.gui.legacy.action.BaseAction;
+import org.rhq.enterprise.gui.legacy.util.RequestUtils;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
+import org.rhq.enterprise.server.alert.AlertManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Struts action to re-enable an alert definition from the
+ * AlertdefinitionActive.jsp tile, that gets included from
+ * ViewAlertProperties.jsp
+ * @author Heiko W. Rupp
+ */
+public class ReenableAlertDefinitionAction extends BaseAction {
+
+ private final Log log = LogFactory.getLog(ReenableAlertDefinitionAction.class);
+
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ Subject subject = RequestUtils.getSubject(request);
+ AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
+
+ Map<String,Object> params = new HashMap<String,Object>(4);
+ // pass-through the alertId and resource id
+ Integer alertId = new Integer(request.getParameter("a"));
+ request.setAttribute("a", alertId);
+ params.put("a",alertId);
+
+ Integer alertDefId = new Integer(request.getParameter("ad"));
+ request.setAttribute("ad", alertDefId);
+ params.put("ad",alertDefId);
+
+ Integer resourceId = new Integer(request.getParameter("id"));
+ request.setAttribute("id",resourceId);
+ params.put("id",resourceId);
+
+ String mode = request.getParameter("mode");
+ request.setAttribute("mode",mode);
+ params.put("mode",mode);
+
+ alertDefinitionManager.enableAlertDefinitions(subject, new Integer[]{alertDefId});
+
+ log.debug("Reenabled Alert definition with id " + alertId + " and user " + subject.getName());
+
+ return returnSuccess(request,mapping,params);
+ }
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index a4c1b31..76321ce 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -2563,9 +2563,13 @@
scope="request"
type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AckAlertAction">
<set-property property="title" value="View+Alert"/>
- <exception key="exception.AlertNotFoundException"
- type="org.rhq.enterprise.server.legacy.events.AlertNotFoundException"
- path="/common/GenericError.jsp"/>
+ <forward name="success" path="/alerts/Alerts.do" redirect="true" />
+ </action>
+
+ <action path="/alerts/RenableAlertDefinition"
+ scope="request"
+ type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.ReenableAlertDefinitionAction">
+ <set-property property="title" value="View+Alert"/>
<forward name="success" path="/alerts/Alerts.do" redirect="true" />
</action>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AlertDefinitionActive.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AlertDefinitionActive.jsp
index 6affcc2..ed6b4fa 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AlertDefinitionActive.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AlertDefinitionActive.jsp
@@ -14,10 +14,14 @@
<fmt:message key="alert.config.props.PB.ActiveYes"/>
</td>
</c:when>
- <c:otherwise>
+ <c:otherwise>
<td width="30%" class="BlockContent">
- <html:img page="/images/icon_available_red.gif" width="12" height="12" border="0"/>
- <fmt:message key="alert.config.props.PB.ActiveNo"/>
+ <html:img page="/images/icon_available_red.gif" width="12" height="12" border="0"/>
+ <fmt:message key="alert.config.props.PB.ActiveNo"/>
+
+ <c:if test="${not alertDef.deleted}">
+ <a href="/alerts/RenableAlertDefinition.do?id=${Resource.id}&a=${alert.id}&mode=${param.mode}&ad=${alertDef.id}">click to re-enable</a>
+ </c:if>
</td>
</c:otherwise>
</c:choose>
commit 7b5ccc130607114a539bae8a97e7b097e7edc1ba
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 24 13:27:56 2010 +0100
BZ 567925 - a follow up to my previous commit should finally fix the issue.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 54cebf6..b0db81c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2204,7 +2204,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
for (T r : results) {
MutableDisambiguationReport<T> value = new MutableDisambiguationReport<T>();
value.original = r;
- reportByResourceId.put(extractor.extract(r), value);
+ int resourceId = extractor.extract(r);
+ if (resourceId > 0) {
+ reportByResourceId.put(resourceId, value);
+ }
}
//k, now let's construct the JPQL query to get the parents and type infos...
@@ -2247,10 +2250,18 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
//now we have all the information to create the result.
//first create the immutable reports.
- List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(reportByResourceId.size());
+ List<DisambiguationReport<T>> resolution = new ArrayList<DisambiguationReport<T>>(results.size());
- for (Map.Entry<Integer, MutableDisambiguationReport<T>> entry : reportByResourceId.entrySet()) {
- resolution.add(entry.getValue().getReport());
+ for(T result : results) {
+ int resourceId = extractor.extract(result);
+ if (resourceId > 0) {
+ MutableDisambiguationReport<T> report = reportByResourceId.get(resourceId);
+ resolution.add(report.getReport());
+ } else {
+ //this result doesn't correspond to any resource, need to handle it specially
+ DisambiguationReport<T> report = new DisambiguationReport<T>(result, Collections.<ResourceParentFlyweight>emptyList(), null, null);
+ resolution.add(report);
+ }
}
return new ResourceNamesDisambiguationResult<T>(resolution, typeResolutionNeeded, parentResolutionNeeded,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 2c99c9d..6db6155 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -36,6 +36,7 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceError;
import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
import org.rhq.core.domain.resource.composite.RecentlyAddedResourceComposite;
import org.rhq.core.domain.resource.composite.ResourceAvailabilitySummary;
import org.rhq.core.domain.resource.composite.ResourceComposite;
@@ -449,7 +450,12 @@ public interface ResourceManagerLocal {
* The disambiguation result contains information on what types of information are needed to make the resources
* in the original result unambiguous and contains the decorated original data in the same order as the
* supplied result list.
- *
+ * <p>
+ * The objects in results do not necessarily need to correspond to a resource. In case of such objects,
+ * the resourceIdExtractor should return 0. In the resulting report such objects will still be wrapped
+ * in a {@link DisambiguationReport} but the parent list will be empty and resource type and plugin name will
+ * be null.
+ *
* @see ResourceNamesDisambiguationResult
*
* @param <T> the type of the result elements
commit ee6254859736c4b3447259517988e6ffe57e4cc8
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 24 12:33:52 2010 +0100
Fixing an NPE on alert definitions subsystem page caused by alert defs without an attached resource.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
index 4d656b5..5831f3e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
@@ -34,6 +34,7 @@ import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.composite.AlertDefinitionComposite;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
@@ -74,7 +75,8 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
private IntExtractor<AlertDefinitionComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<AlertDefinitionComposite>() {
public int extract(AlertDefinitionComposite object) {
- return object.getAlertDefinition().getResource().getId();
+ Resource resource = object.getAlertDefinition().getResource();
+ return resource == null ? 0 : resource.getId();
}
};
commit 7369db803076bc12f02bcc6131b9fe1e5303ae47
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Feb 24 01:57:08 2010 -0500
antlr should compile the grammar files before the standard maven compile phase
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index b322503..533c0e9 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -467,10 +467,10 @@
<version>3.2</version>
<executions>
<execution>
- <phase>compile</phase>
- <goals>
- <goal>antlr</goal>
- </goals>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>antlr</goal>
+ </goals>
<configuration>
<conversionTimeout>30000</conversionTimeout>
<debug>false</debug>
commit dbbfa75ddfa4ce4443f2f72df49b483970ea4e8c
Author: Justin Harris <jharris(a)redhat.com>
Date: Tue Feb 23 16:54:51 2010 -0500
Adding in validation rules and messaging for the alert conditions page.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionCategory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionCategory.java
index b304f29..531857b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionCategory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/AlertConditionCategory.java
@@ -60,6 +60,10 @@ public enum AlertConditionCategory {
return name();
}
+ public String getDisplayName() {
+ return displayName;
+ }
+
@Override
public String toString() {
return this.displayName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationRequestStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationRequestStatus.java
index cd0dcdb..bf816e8 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationRequestStatus.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/OperationRequestStatus.java
@@ -38,6 +38,10 @@ public enum OperationRequestStatus {
this.displayName = displayName;
}
+ public String getDisplayName() {
+ return displayName;
+ }
+
public String toString() {
return displayName;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java
new file mode 100644
index 0000000..62a6fc0
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionMessages.java
@@ -0,0 +1,60 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+(a)Scope(ScopeType.APPLICATION)
+@Name("alertConditionMessages")
+public class AlertConditionMessages {
+
+ @In
+ private Map<String, String> messages;
+
+ public String getThreshold() {
+ return translate("errors.double", "Threshold");
+ }
+
+ public String getPercentRange() {
+ return translate("errors.range", "Threshold", "0%", "1000%");
+ }
+
+ public String getDampeningCount() {
+ return translate("errors.integer", "Dampening Count");
+ }
+
+ public String getDampeningEvaluation() {
+ return translate("errors.integer", "Dampening Evaluations");
+ }
+
+ public String getTimePeriod() {
+ return translate("errors.integer", "Time Period");
+ }
+
+ private String translate(String key, Object... params) {
+ String message = messages.get(key);
+
+ return MessageFormat.format(message, params);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
index 1d5fe02..f15e5de 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.alert;
+import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@@ -74,9 +75,9 @@ public class AlertConditionUIBean {
private Map<String, String> conditionExpressions;
private Map<String, String> availabilities;
private Map<String, String> severities;
- private Map<String, String> operationStatuses;
private Map<String, String> comparators;
private Map<String, String> baselines;
+ private Map<String, String> operationStatuses;
private Map<String, Integer> measurements;
private Map<String, Integer> traits;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
index f3365f0..c32965d 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.alert;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -36,6 +37,7 @@ import org.jboss.seam.international.StatusMessage.Severity;
import org.jboss.seam.log.Log;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
+import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -70,7 +72,7 @@ public class AlertConditionsUIBean {
@In
private AlertDescriber alertDescriber;
private MetricAbsoluteConverter metricAbsoluteConverter = new MetricAbsoluteConverter();
- private Map<AlertConditionCategory, String> categories;
+ private Map<String, String> categories;
private List<ConditionDescription> conditionDescriptions;
private AlertCondition currentCondition;
@@ -86,11 +88,19 @@ public class AlertConditionsUIBean {
}
public String getMeasurementDefinitionId() {
- return measurementDefinitionId.toString();
+ if (this.measurementDefinitionId != null) {
+ return measurementDefinitionId.toString();
+ }
+
+ return null;
}
public void setMeasurementDefinitionId(String measurementDefinitionId) {
- this.measurementDefinitionId = Integer.parseInt(measurementDefinitionId);
+ try {
+ this.measurementDefinitionId = Integer.parseInt(measurementDefinitionId);
+ } catch (NumberFormatException e) {
+ this.measurementDefinitionId = null;
+ }
}
public String getThreshold() {
@@ -109,7 +119,7 @@ public class AlertConditionsUIBean {
return conditionDescriptions;
}
- public Map<AlertConditionCategory, String> getCategories() {
+ public Map<String, String> getCategories() {
return categories;
}
@@ -136,7 +146,10 @@ public class AlertConditionsUIBean {
@Create
public void init() {
this.conditionDescriptions = createDescriptions();
- this.categories = createCategoryMap();
+ this.categories = createCategories();
+
+ // start out with an empty condition
+ createCondition();
}
private List<ConditionDescription> createDescriptions() {
@@ -183,6 +196,10 @@ public class AlertConditionsUIBean {
}
public String saveAlertDefinition() {
+ if (!validateDefinition()) {
+ return null;
+ }
+
alertDefinition.setConditions(findConditions());
try {
@@ -198,12 +215,16 @@ public class AlertConditionsUIBean {
}
public String newAlertDefinition() {
+ if (!validateDefinition()) {
+ return null;
+ }
+
alertDefinition.setConditions(findConditions());
try {
alertDefinitionManager.createAlertDefinition(subject, alertDefinition, resourceId);
} catch(Exception e) {
- this.facesMessages.add(Severity.ERROR, "There was an error creating the alert definitino.");
+ this.facesMessages.add(Severity.ERROR, "There was an error creating the alert definition.");
this.log.error("Error persisting AlertDefinition: " + alertDefinition.getName(), e);
return null;
@@ -212,6 +233,28 @@ public class AlertConditionsUIBean {
return SUCCESS_OUTCOME;
}
+ private boolean validateDefinition() {
+ Set<AlertCondition> conditions = findConditions();
+
+ if (conditions.isEmpty()) {
+ this.facesMessages.add(Severity.ERROR, "Please add at least one condition.");
+
+ return false;
+ }
+
+ AlertDampening dampening = alertDefinition.getAlertDampening();
+
+ if (dampening.getCategory() == AlertDampening.Category.PARTIAL_COUNT) {
+ if (dampening.getValue() > dampening.getPeriod()) {
+ this.facesMessages.addFromResourceBundle(Severity.ERROR, "alert.config.error.PartialCountRangeTooSmall");
+
+ return false;
+ }
+ }
+
+ return true;
+ }
+
private boolean shouldSetMeasurementDefinition() {
if (currentCondition != null) {
AlertConditionCategory category = currentCondition.getCategory();
@@ -245,17 +288,17 @@ public class AlertConditionsUIBean {
return conditionSet;
}
- private Map<AlertConditionCategory, String> createCategoryMap() {
- Map<AlertConditionCategory, String> categoryMap = new HashMap<AlertConditionCategory, String>();
+ private Map<String, String> createCategories() {
+ Map<String, String> categoryMap = new HashMap<String, String>();
+ List<AlertConditionCategory> categoryList = new ArrayList(Arrays.asList(AlertConditionCategory.values()));
+ categoryList.remove(AlertConditionCategory.ALERT);
- for (AlertConditionCategory category : AlertConditionCategory.values()) {
- categoryMap.put(category, category.getName());
+ if (configurationManager.getResourceConfigurationDefinitionForResourceType(subject, resourceType.getId()) == null) {
+ categoryList.remove(AlertConditionCategory.RESOURCE_CONFIG);
}
- categoryMap.remove(AlertConditionCategory.ALERT);
-
- if (configurationManager.getResourceConfigurationDefinitionForResourceType(subject, resourceType.getId()) == null) {
- categoryMap.remove(AlertConditionCategory.RESOURCE_CONFIG);
+ for (AlertConditionCategory category : categoryList) {
+ categoryMap.put(category.toString(), category.getName());
}
return categoryMap;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
index eec5333..19dae93 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
@@ -30,6 +30,7 @@ import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.faces.Converter;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConversionException;
import org.rhq.core.domain.measurement.util.MeasurementConverter;
@Converter
@@ -38,9 +39,13 @@ import org.rhq.core.domain.measurement.util.MeasurementConverter;
public class MetricPercentConverter implements javax.faces.convert.Converter {
public Object getAsObject(FacesContext context, UIComponent component, String value) {
- MeasurementNumericValueAndUnits percentage = MeasurementConverter.parse(value, MeasurementUnits.PERCENTAGE);
+ try {
+ MeasurementNumericValueAndUnits percentage = MeasurementConverter.parse(value, MeasurementUnits.PERCENTAGE);
- return percentage.getValue();
+ return percentage.getValue();
+ } catch (MeasurementConversionException e) {
+ return null;
+ }
}
public String getAsString(FacesContext context, UIComponent component, Object value) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/AlertValidatorUtil.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/AlertValidatorUtil.java
new file mode 100644
index 0000000..d8f142c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/AlertValidatorUtil.java
@@ -0,0 +1,45 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert.validator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.validator.ValidatorException;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.faces.FacesMessages;
+
+@AutoCreate
+(a)Scope(ScopeType.APPLICATION)
+@Name("validatorUtil")
+public class AlertValidatorUtil {
+
+ public void error(String message) throws ValidatorException {
+ FacesMessage facesMessage = FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR , message);
+
+ throw new ValidatorException(facesMessage);
+ }
+
+ public void templateError(String key, Object... params) throws ValidatorException {
+ FacesMessage facesMessage = FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR , key, key, params);
+
+ throw new ValidatorException(facesMessage);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/EventRegexValidator.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/EventRegexValidator.java
new file mode 100644
index 0000000..e4831d4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/validator/EventRegexValidator.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert.validator;
+
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.faces.Validator;
+
+@Name("eventRegexValidator")
+@Validator
+public class EventRegexValidator implements javax.faces.validator.Validator {
+
+ @In
+ private AlertValidatorUtil validatorUtil;
+
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+ String stringValue = (String)value;
+
+ if (stringValue != null && stringValue.length() > 0) {
+ try {
+ Pattern.compile(stringValue);
+ } catch (PatternSyntaxException e) {
+ validatorUtil.templateError("alert.config.error.InvalidEventDetails");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
index 24a0bdf..a5500e4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
@@ -35,7 +35,16 @@
</ui:define>
<ui:define name="body">
- <a4j:form id="alertConditionsForm">
+
+ <rich:messages showSummary="true"
+ infoClass="InfoBlock"
+ warnClass="WarnBlock"
+ errorClass="ErrorBlock"
+ fatalClass="FatalBlock"
+ layout="table"
+ width="100%" />
+
+ <h:form id="alertConditionsForm">
<ui:insert name="formTop" />
<rich:panel id="conditionsPanel">
@@ -44,11 +53,11 @@
</f:facet>
<rich:panel id="conditionExpression">
- <h:outputText value="#{messages['alert.config.props.CB.ExpressionDetails.1']} " />
- <h:selectOneMenu value="#{alertDefinition.conditionExpression}">
- <f:selectItems value="#{alertConditionUIBean.conditionExpressions}" />
- </h:selectOneMenu>
- <h:outputText value=" #{messages['alert.config.props.CB.ExpressionDetails.2']}" />
+ <h:outputText value="#{messages['alert.config.props.CB.ExpressionDetails.1']} " />
+ <h:selectOneMenu value="#{alertDefinition.conditionExpression}">
+ <f:selectItems value="#{alertConditionUIBean.conditionExpressions}" />
+ </h:selectOneMenu>
+ <h:outputText value=" #{messages['alert.config.props.CB.ExpressionDetails.2']}" />
</rich:panel>
<rich:panel id="conditionSet">
@@ -56,8 +65,6 @@
<h:outputText value="Condition Set"/>
</f:facet>
- <h:messages />
-
<rich:dataTable id="categoryTable" value="#{alertConditionsUIBean.conditionDescriptions}" var="conditionDescription">
<rich:column>
<h:outputText value="#{conditionDescription.description}" />
@@ -71,6 +78,7 @@
<f:setPropertyActionListener value="#{conditionDescription.condition}" target="#{alertConditionsUIBean.currentCondition}" />
<rich:componentControl for="categoryModalPanel" attachTo="editButton" operation="show" event="onclick" />
+ <a4j:support event="onclick" reRender="categoryOptionOkButton" />
</a4j:commandButton>
</rich:column>
@@ -93,7 +101,7 @@
action="#{alertConditionsUIBean.createCondition}"
styleClass="buttonmed">
<rich:componentControl for="categoryModalPanel" attachTo="addConditionButton" operation="show" event="onclick" />
- <a4j:support event="onclick" reRender="categoryOptionsPanel" />
+ <a4j:support event="onclick" reRender="categoryOptionsPanel,categoryOptionOkButton" />
</a4j:commandButton>
</rich:panel>
@@ -107,13 +115,20 @@
<h:outputText value="#{messages['alert.config.props.CB.Recovery']} " />
<h:outputText value="#{messages['alert.config.props.CB.RecoveryFor']}" />
- <h:selectOneMenu value="#{alertDefinition.recoveryId}">
+ <h:selectOneMenu id="recoveryForAlertSelectBox"
+ value="#{alertDefinition.recoveryId}"
+ disabled="#{alertDefinition.willRecover}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" itemValue="0" />
<f:selectItems value="#{alertConditionUIBean.existingAlerts}" />
+ <a4j:support event="onchange" reRender="willRecoverCheckbox" />
</h:selectOneMenu>
<br />
- <h:selectBooleanCheckbox id="willRecoverCheckbox" value="#{alertDefinition.willRecover}" />
+ <h:selectBooleanCheckbox id="willRecoverCheckbox"
+ value="#{alertDefinition.willRecover}"
+ disabled="#{alertDefinition.recoveryId != 0}">
+ <a4j:support event="onchange" reRender="recoveryForAlertSelectBox" />
+ </h:selectBooleanCheckbox>
<h:outputLabel for="willRecoverCheckbox" value="#{messages['alert.config.props.CB.Content.UntilRecovered']}" />
<br />
@@ -151,28 +166,63 @@
<ui:fragment rendered="#{alertDefinition.alertDampening.category == 'CONSECUTIVE_COUNT'}">
<h:outputText value="#{messages['alert.config.props.CB.Content.DampenConsecutiveCount.1']} " />
- <h:inputText value="#{alertDefinition.alertDampening.value}"
- required="true"
- maxlength="5"/>
+ <h:inputText id="consecutiveCount"
+ value="#{alertDefinition.alertDampening.value}"
+ size="4"
+ required="true"
+ requiredMessage="#{alertConditionMessages.dampeningCount}"
+ validatorMessage="#{alertConditionMessages.dampeningCount}"
+ converterMessage="#{alertConditionMessages.dampeningCount}">
+ <f:validateDoubleRange minimum="0" />
+ </h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenConsecutiveCount.2']}" />
</ui:fragment>
<ui:fragment rendered="#{alertDefinition.alertDampening.category == 'PARTIAL_COUNT'}">
<h:outputText value="#{messages['alert.config.props.CB.Content.DampenPartialCount.1']} " />
- <h:inputText value="#{alertDefinition.alertDampening.value}"
- required="true"
- maxlength="5"/>
+ <h:inputText id="partialCount"
+ value="#{alertDefinition.alertDampening.value}"
+ size="4"
+ required="true"
+ requiredMessage="#{alertConditionMessages.dampeningCount}"
+ validatorMessage="#{alertConditionMessages.dampeningCount}"
+ converterMessage="#{alertConditionMessages.dampeningCount}">
+ <f:validateLongRange minimum="0" />
+ </h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.2']} " />
- <h:inputText value="#{alertDefinition.alertDampening.period}" />
+ <h:inputText id="partialCountPeriod"
+ value="#{alertDefinition.alertDampening.period}"
+ size="4"
+ required="true"
+ requiredMessage="#{alertConditionMessages.dampeningEvaluation}"
+ validatorMessage="#{alertConditionMessages.dampeningEvaluation}"
+ converterMessage="#{alertConditionMessages.dampeningEvaluation}">
+ <f:validateLongRange minimum="0" />
+ </h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.3']}" />
</ui:fragment>
<ui:fragment rendered="#{alertDefinition.alertDampening.category == 'DURATION_COUNT'}">
<h:outputText value="#{messages['alert.config.props.CB.Content.DampenDurationCount.1']} " />
- <h:inputText value="#{alertDefinition.alertDampening.value}" />
+ <h:inputText id="durationCount"
+ value="#{alertDefinition.alertDampening.value}"
+ size="4"
+ required="true"
+ requiredMessage="#{alertConditionMessages.dampeningCount}"
+ validatorMessage="#{alertConditionMessages.dampeningCount}"
+ converterMessage="#{alertConditionMessages.dampeningCount}">
+ <f:validateLongRange minimum="0" />
+ </h:inputText>
<h:outputText value=" #{messages['alert.config.props.CB.Content.DampenDurationCount.2']} " />
- <h:inputText value="#{alertDefinition.alertDampening.period}" />
-
+ <h:inputText id="durationCountPeriod"
+ value="#{alertDefinition.alertDampening.period}"
+ size="4"
+ required="true"
+ requiredMessage="#{alertConditionMessages.timePeriod}"
+ validatorMessage="#{alertConditionMessages.timePeriod}"
+ converterMessage="#{alertConditionMessages.timePeriod}">
+ <f:validateLongRange minimum="0" />
+ </h:inputText>
<h:selectOneMenu value="#{alertDefinition.alertDampening.periodUnits}">
<f:selectItems value="#{alertConditionUIBean.timeUnits}" />
</h:selectOneMenu>
@@ -190,7 +240,7 @@
styleClass="buttonmed"
style="margin: 10px;" />
</ui:insert>
- </a4j:form>
+ </h:form>
<rich:modalPanel id="categoryModalPanel" moveable="false" autosized="true" width="400">
@@ -199,8 +249,8 @@
<h:form id="categoryForm">
<h:selectOneMenu value="#{alertConditionsUIBean.currentCondition.category}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
- <s:selectItems value="#{alertConditionsUIBean.categories}" />
- <a4j:support event="onchange" reRender="categoryOptions" status="categoryLoadStatus" />
+ <f:selectItems value="#{alertConditionsUIBean.categories}" />
+ <a4j:support event="onchange" reRender="EditConditionForm" status="categoryLoadStatus" />
</h:selectOneMenu>
</h:form>
@@ -221,14 +271,20 @@
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'CONTROL'}">
<h:outputLabel for="operationSelection" value="#{messages['alert.config.props.CB.Content.ControlAction']} " />
- <h:selectOneMenu id="operationSelection" value="#{alertConditionsUIBean.currentCondition.name}">
+ <h:selectOneMenu id="operationSelection"
+ value="#{alertConditionsUIBean.currentCondition.name}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoControlActionSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.operations}" />
</h:selectOneMenu>
<h:outputText value=" #{messages['alert.config.props.CB.Content.Comparator.=']} " />
- <h:selectOneMenu id="operationStatusSelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <h:selectOneMenu id="operationStatusSelection"
+ value="#{alertConditionsUIBean.currentCondition.option}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoControlActionStatusSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.operationStatuses}" />
</h:selectOneMenu>
@@ -238,7 +294,10 @@
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'AVAILABILITY'}">
<h:outputLabel for="availabilitySelection" value="#{messages['alert.config.props.CB.Content.Availability']} " />
- <h:selectOneMenu id="availabilitySelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <h:selectOneMenu id="availabilitySelection"
+ value="#{alertConditionsUIBean.currentCondition.option}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoAvailabilityStatusSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.availabilities}" />
</h:selectOneMenu>
@@ -248,7 +307,10 @@
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'CHANGE'}">
<h:outputLabel for="metricChangeSelection" value="#{messages['alert.config.props.CB.Content.Metric']} " />
- <h:selectOneMenu id="metricChangeSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <h:selectOneMenu id="metricChangeSelection"
+ value="#{alertConditionsUIBean.measurementDefinitionId}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoMetricSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.measurements}" />
</h:selectOneMenu>
@@ -260,7 +322,10 @@
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'THRESHOLD'}">
<h:outputLabel for="metricThresholdSelection" value="#{messages['alert.config.props.CB.Content.Metric']}" />
- <h:selectOneMenu id="metricThresholdSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <h:selectOneMenu id="metricThresholdSelection"
+ value="#{alertConditionsUIBean.measurementDefinitionId}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoMetricSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.measurements}" />
</h:selectOneMenu>
@@ -273,14 +338,23 @@
<br />
<br />
- <h:inputText id="metricThresholdAbsolute" value="#{alertConditionsUIBean.threshold}" />
+ <h:inputText id="metricThresholdAbsolute"
+ value="#{alertConditionsUIBean.threshold}"
+ required="true"
+ requiredMessage="#{alertConditionMessages.threshold}"
+ validatorMessage="#{alertConditionMessages.threshold}">
+ <f:validateDoubleRange minimum="0.0" />
+ </h:inputText>
<h:outputLabel for="metricThresholdAbsolute" value="#{messages['alert.config.props.CB.Content.AbsoluteValue']}" />
</ui:fragment>
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'BASELINE'}">
<h:outputLabel for="metricBaselineSelection" value="#{messages['alert.config.props.CB.Content.Metric']} " />
- <h:selectOneMenu id="metricBaselineSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <h:selectOneMenu id="metricBaselineSelection"
+ value="#{alertConditionsUIBean.measurementDefinitionId}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoMetricSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.measurements}" />
</h:selectOneMenu>
@@ -293,10 +367,20 @@
<br />
<br />
- <h:inputText id="metricBaselinePercent" value="#{alertConditionsUIBean.currentCondition.threshold}" converter="#{metricPercentConverter}" />
+ <h:inputText id="metricBaselinePercent"
+ value="#{alertConditionsUIBean.currentCondition.threshold}"
+ converter="#{metricPercentConverter}"
+ required="true"
+ requiredMessage="#{alertConditionMessages.percentRange}"
+ validatorMessage="#{alertConditionMessages.percentRange}">
+ <f:validateDoubleRange minimum="0.0" maximum="1000.0" />
+ </h:inputText>
<h:outputLabel for="metricBaselinePercent" value=" #{messages['alert.config.props.CB.Content.Percent']} " />
- <h:selectOneMenu id="metricBaselineBaselineSelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <h:selectOneMenu id="metricBaselineBaselineSelection"
+ value="#{alertConditionsUIBean.currentCondition.option}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoBaselineOptionSelected']}">
<f:selectItems value="#{alertConditionUIBean.baselines}" />
</h:selectOneMenu>
</ui:fragment>
@@ -305,20 +389,29 @@
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'EVENT'}">
<h:outputLabel for="eventSelection" value="#{messages['alert.config.props.CB.Content.EventSeverity']} " />
- <h:selectOneMenu id="eventSelection" value="#{alertConditionsUIBean.currentCondition.name}">
+ <h:selectOneMenu id="eventSelection"
+ value="#{alertConditionsUIBean.currentCondition.name}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoEventSeveritySelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.severities}" />
</h:selectOneMenu>
<h:outputText value=" #{messages['alert.config.props.CB.Content.Match']}" />
- <h:inputText id="eventExpression" value="#{alertConditionsUIBean.currentCondition.option}" />
+ <h:inputText id="eventExpression"
+ value="#{alertConditionsUIBean.currentCondition.option}">
+ <f:validator validatorId="eventRegexValidator" />
+ </h:inputText>
</ui:fragment>
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'TRAIT'}">
<h:outputLabel for="traitSelection" value="#{messages['alert.config.props.CB.Content.Trait']} " />
- <h:selectOneMenu id="traitSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <h:selectOneMenu id="traitSelection"
+ value="#{alertConditionsUIBean.measurementDefinitionId}"
+ required="true"
+ requiredMessage="#{messages['alert.config.error.NoTraitSelected']}">
<f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
<f:selectItems value="#{alertConditionUIBean.traits}" />
</h:selectOneMenu>
@@ -335,10 +428,11 @@
</rich:panel>
<h:commandButton id="categoryOptionOkButton"
- value="OK"
- action="#{alertConditionsUIBean.updateCondition}"
- styleClass="buttonmed"
- style="margin: 5px;">
+ value="OK"
+ rendered="#{not empty alertConditionsUIBean.currentCondition.category}"
+ action="#{alertConditionsUIBean.updateCondition}"
+ styleClass="buttonmed"
+ style="margin: 5px;">
<rich:componentControl for="categoryModalPanel" attachTo="categoryOptionOkButton" operation="hide" event="onclick" />
<a4j:support event="onclick" reRender="categoryTable" />
</h:commandButton>
commit d17f4616c524e65decd6af3db65df8a83d18c12e
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 16:54:20 2010 -0500
add anltr support to server/jar maven module, update eclipse classpath accordingly;
diff --git a/.classpath b/.classpath
index 660d74d..1a35400 100644
--- a/.classpath
+++ b/.classpath
@@ -19,6 +19,7 @@
<classpathentry kind="src" path="modules/plugins/jboss-cache/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/jboss-cache-v3/src/main/java"/>
<classpathentry kind="src" path="etc/samples/perspectives/sample-perspective/app/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/jar/target/generated-sources/antlr3"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index e109c41..b322503 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -366,6 +366,13 @@
<artifactId>test-utils</artifactId>
<version>${version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>3.2</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<build>
@@ -454,6 +461,41 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <version>3.2</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>antlr</goal>
+ </goals>
+ <configuration>
+ <conversionTimeout>30000</conversionTimeout>
+ <debug>false</debug>
+ <dfa>false</dfa>
+ <nfa>false</nfa>
+ <excludes>
+
+ </excludes>
+ <includes>
+
+ </includes>
+ <libDirectory>src/main/antlr3/imports</libDirectory>
+ <messageFormat>antlr</messageFormat>
+ <outputDirectory>target/generated-sources/antlr3</outputDirectory>
+ <printGrammar>false</printGrammar>
+ <profile>false</profile>
+ <report>false</report>
+ <sourceDirectory>src/main/antlr3</sourceDirectory>
+ <trace>false</trace>
+ <verbose>true</verbose>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
commit e956b6f8b2608bc9d2941daba6e732caf4ad5715
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 22:25:45 2010 +0100
Introduce the possibility to ack an alert on the detail page.
BZ 567383
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/AckAlertAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/AckAlertAction.java
new file mode 100644
index 0000000..6043d19
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/AckAlertAction.java
@@ -0,0 +1,78 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.legacy.action.resource.common.monitor.alerts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.tiles.ComponentContext;
+import org.apache.struts.tiles.actions.TilesAction;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.gui.legacy.action.BaseAction;
+import org.rhq.enterprise.gui.legacy.util.RequestUtils;
+import org.rhq.enterprise.server.alert.AlertManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Struts action to acknowledge one single alert from the
+ * ViewAlertProperties.jsp page
+ * @author Heiko W. Rupp
+ */
+public class AckAlertAction extends BaseAction {
+
+ Log log = LogFactory.getLog(AckAlertAction.class);
+
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ Subject subject = RequestUtils.getSubject(request);
+ AlertManagerLocal alertManager = LookupUtil.getAlertManager();
+
+ Map params = new HashMap(3);
+ // pass-through the alertId and resource id
+ Integer alertId = new Integer(request.getParameter("a"));
+ request.setAttribute("a", alertId);
+ params.put("a",alertId);
+
+ Integer resourceId = new Integer(request.getParameter("id"));
+ request.setAttribute("id",resourceId);
+ params.put("id",resourceId);
+
+ String mode = request.getParameter("mode");
+ request.setAttribute("mode",mode);
+ params.put("mode",mode);
+
+ alertManager.acknowledgeAlert(alertId,subject);
+
+ log.debug("Acknowledged Alert with id " + alertId + " and user " + subject.getName());
+
+ return returnSuccess(request,mapping,params);
+ }
+
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index 41da1ee..a4c1b31 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -2559,6 +2559,16 @@
path="/common/GenericError.jsp"/>
</action>
+ <action path="/alerts/AckAlert"
+ scope="request"
+ type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AckAlertAction">
+ <set-property property="title" value="View+Alert"/>
+ <exception key="exception.AlertNotFoundException"
+ type="org.rhq.enterprise.server.legacy.events.AlertNotFoundException"
+ path="/common/GenericError.jsp"/>
+ <forward name="success" path="/alerts/Alerts.do" redirect="true" />
+ </action>
+
<action path="/alerts/ViewDefinition"
scope="request"
type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ViewDefinitionAction">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
index 1b1c04b..0b49ecb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
@@ -39,26 +39,37 @@
<td class="BlockLabel"><fmt:message key="alert.current.detail.props.AlertDate"/></td>
<td class="BlockContent" colspan="2"><hq:dateFormatter time="false" value="${alert.ctime}"/></td>
</tr>
- <tr valign="top">
- <td class="BlockLabel">Acknowledged by:</td>
- <td class="BlockContent">
- <c:if test="${not empty alert.ackBy}">
- <c:out value="${alert.ackBy.firstName}"/>
- <c:out value=" "/>
- <c:out value="${alert.ackBy.lastName}"/>
- <c:out value=" ("/>
- <c:out value="${alert.ackBy.name}"/>
- <c:out value=")"/>
- </c:if>
- </td>
- <td class="BlockLabel">Acknowledged at:</td>
- <td class="BlockContent">
- <c:if test="${alert.ackTime > 0}">
- <hq:dateFormatter time="false" value="${alert.ackTime}"/>
- </c:if>
+ <c:choose>
+ <c:when test="${not empty alert.ackBy}">
+ <tr valign="top">
+ <td class="BlockLabel">Acknowledged by:</td>
+ <td class="BlockContent">
+ <c:out value="${alert.ackBy.firstName}"/>
+ <c:out value=" "/>
+ <c:out value="${alert.ackBy.lastName}"/>
+ <c:out value=" ("/>
+ <c:out value="${alert.ackBy.name}"/>
+ <c:out value=")"/>
+ </td>
+ <td class="BlockLabel">Acknowledged at:</td>
+ <td class="BlockContent">
+ <hq:dateFormatter time="false" value="${alert.ackTime}"/>
+ </td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <tr valign="top">
+ <td class="BlockLabel">Acknowledge Alert</td>
+ <td class="BlockContent">
+ <a href="/alerts/AckAlert.do?id=${Resource.id}&a=${alert.id}&mode=${param.mode}">click here</a>
+ </td>
+ <td class="BlockContent"> </td>
+ <td class="BlockContent"> </td>
+ </tr>
- </td>
- </tr>
+ </c:otherwise>
+
+ </c:choose>
<tr>
<td colspan="5" class="BlockContent"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
</tr>
commit fc1118af81ff953f2c05fb696629d799169b22f1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 13:21:29 2010 -0500
fix some whitespace issues
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index f14e145..e109c41 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -414,7 +414,7 @@
Build-Jdk=${java.version}
Build-OS-Name=${os.name}
Build-OS-Version=${os.version}
-</echo>
+ </echo>
</tasks>
</configuration>
<goals>
@@ -593,8 +593,7 @@
<link href="../domain" />
<link href="../plugin-api" />
<link href="http://java.sun.com/j2se/1.5.0/docs/api/" />
- <bottom><![CDATA[Copyright © 2008-2009 <a href="http://rhq-project.org/">Red Hat, Inc.</a>. All Rights Reserved.
-]]></bottom>
+ <bottom><![CDATA[Copyright © 2008-2009 <a href="http://rhq-project.org/">Red Hat, Inc.</a>. All Rights Reserved.]]></bottom>
</javadoc>
</tasks>
</configuration>
commit 1c79730a4d3ce260e2f3d6ce9b8e971da158e1d7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 13:10:18 2010 -0500
add some default, global saved searches for the resource context
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml
new file mode 100644
index 0000000..1a11114
--- /dev/null
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/search-data.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dbsetup name="search-data.xml">
+
+ <!-- overlord-created, global, default saved searches -->
+ <table name="RHQ_SAVED_SEARCH">
+ <data ID="1"
+ CONTEXT="Resource"
+ NAME="Downed Platforms"
+ DESCRIPTION="All downed machines across the entire enterprise"
+ PATTERN="down platform"
+ LAST_COMPUTE_TIME="0"
+ SUBJECT="1"
+ GLOBAL="TRUE" />
+ <data ID="2"
+ CONTEXT="Resource"
+ NAME="Downed Servers"
+ DESCRIPTION="All downed servers across the entire enterprise"
+ PATTERN="down server"
+ LAST_COMPUTE_TIME="0"
+ SUBJECT="1"
+ GLOBAL="TRUE" />
+ </table>
+
+</dbsetup>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 834e9ce..6fe555e 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3202,13 +3202,18 @@
</statement>
</schema-directSQL>
</schemaSpec>
-
+
<schemaSpec version="2.82">
<schema-directSQL>
<statement desc="Creating table RHQ_SAVED_SEARCH">
CREATE TABLE RHQ_SAVED_SEARCH ( ID INTEGER )
</statement>
</schema-directSQL>
+ <schema-directSQL>
+ <statement desc="Creating primary key for RHQ_AFFINITY_GROUP">
+ ALTER TABLE RHQ_SAVED_SEARCH ADD PRIMARY KEY ( ID )
+ </statement>
+ </schema-directSQL>
<schema-addColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" columnType="VARCHAR2" precision="25" />
<schema-alterColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" nullable="FALSE" />
@@ -3227,6 +3232,29 @@
<schema-addColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" columnType="BOOLEAN" />
<schema-alterColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" nullable="FALSE" />
</schemaSpec>
+
+ <schemaSpec version="2.82.1">
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Inserting global default saved search 'Downed Platforms'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (1, 'Resource', 'Downed Platforms', 'All downed machines across the entire enterprise', 'down platform', 0, 1, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Inserting global default saved search 'Downed Platforms'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (1, 'Resource', 'Downed Platforms', 'All downed machines across the entire enterprise', 'down platform', 0, 1, 1)
+ </statement>
+ </schema-directSQL>
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql" desc="Inserting global default saved search 'Downed Servers'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (2, 'Resource', 'Downed Servers', 'All downed servers across the entire enterprise', 'down server', 0, 1, true)
+ </statement>
+ <statement targetDBVendor="oracle" desc="Inserting global default saved search 'Downed Servers'">
+ INSERT INTO rhq_saved_search (id, context, name, description, pattern, last_compute_time, subject_id, global)
+ VALUES (2, 'Resource', 'Downed Servers', 'All downed servers across the entire enterprise', 'down server', 0, 1, 1)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
commit 68f3634b787768dd5ee138a04a5398fdd4cb6404
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 12:07:56 2010 -0500
fix copy/paste error for saved search entity annotation
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java
index 9142772..d6b50e7 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java
@@ -87,7 +87,7 @@ public class SavedSearch {
@Column(name = "SUBJECT_ID", nullable = false)
private Subject subject;
- @Column(name = "RESOURCE_ID", insertable = false, updatable = false)
+ @Column(name = "SUBJECT_ID", insertable = false, updatable = false)
private int subjectId;
@Column(name = "GLOBAL", nullable = false)
commit b22dc41c2c2251ee2c29387eabbdfbf9a616a41d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 16:20:56 2010 +0100
Add a new cleanup() method and some JavaDoc
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index 72f6ec8..5b39eae 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -40,9 +40,24 @@ public class CustomAlertSenderBackingBean {
public void setAlertParameters(Configuration alertParameters) {
this.alertParameters = alertParameters;
}
+ /**
+ * This method is called when the alert notification that uses this backing bean
+ * is removed, so that the backing bean can do some cleanup work
+ */
+ protected void cleanup() {}
+ /**
+ * Persist the passed configuration object. This can be a new object or one
+ * that already exists in the database. If the input is null, not persistence
+ * happens and null is returned.
+ * @param config configuration to persist or update
+ * @return a merged copy of the configuration or null
+ */
protected Configuration persistConfiguration(Configuration config) {
+ if (config==null)
+ return null;
+
ConfigurationManagerLocal mgr = LookupUtil.getConfigurationManager();
config = mgr.mergeConfiguration(config);
@@ -50,6 +65,14 @@ public class CustomAlertSenderBackingBean {
}
+ /**
+ * Persist a single property of a given configuration. If the property does not yet exist,
+ * it is created otherwise overwritten with the new value.
+ * @param config configuration the property is on
+ * @param propertyName name of the property to persist
+ * @param value (new) value of the property to persist
+ * @return the updated configuration
+ */
protected Configuration persistProperty(Configuration config, String propertyName, Object value) {
PropertySimple prop = config.getSimple(propertyName);
@@ -65,6 +88,12 @@ public class CustomAlertSenderBackingBean {
return ret;
}
+ /**
+ * Remove one property from the passed configuration. Returns the updated configuration
+ * @param config configuration the property is on
+ * @param propertyName name of the property to remove
+ * @return the updated configuration
+ */
protected Configuration cleanProperty(Configuration config, String propertyName) {
Configuration ret = config;
@@ -76,4 +105,5 @@ public class CustomAlertSenderBackingBean {
return ret;
}
+
}
commit 6c0f0ebe7f448eb3aec0acdf04f581146938f45a
Merge: 354dd60... 59776e2...
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 15:29:43 2010 +0100
Merge branch 'master' into alertPlugin
commit 354dd6076c8e6c700086c6472963924f35b8deb1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 15:28:34 2010 +0100
Cleanup of variable names and obtain the right operation name.
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
index deabeae..2a3b635 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
@@ -28,7 +28,6 @@ import org.apache.commons.logging.LogFactory;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
@@ -54,8 +53,8 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
private String resMode;
private String tokenMode;
Integer resId;
- private Integer operationName;
- private Map<String, Integer> operationNames = new HashMap<String, Integer>();
+ private Integer operationId;
+ private Map<String, Integer> operationIds = new HashMap<String, Integer>();
private String resourceName;
@@ -79,12 +78,12 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
if (resId != null) {
persistProperty(alertParameters, OperationsSender.RESOURCE_ID,resId);
- cleanProperty(alertParameters,OperationsSender.OPERATION_NAME);
+ cleanProperty(alertParameters,OperationsSender.OPERATION_ID);
cleanProperty(alertParameters,OperationsSender.USABLE);
}
- obtainOperationNames();
+ obtainOperationIds();
return ALERT_NOTIFICATIONS;
}
@@ -92,10 +91,10 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
public String selectOperation() {
- log.info("In selectOperation, resId is " + resId + " opName is " + operationName);
+ log.info("In selectOperation, resId is " + resId + " opName is " + operationId);
- if (operationName != null ) {
- persistProperty(alertParameters, OperationsSender.OPERATION_NAME,operationName);
+ if (operationId != null ) {
+ persistProperty(alertParameters, OperationsSender.OPERATION_ID, operationId);
lookupConfiguration();
}
@@ -112,10 +111,10 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
// int operationId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("opId"));
OperationManagerLocal opMan = LookupUtil.getOperationManager();
- obtainOperationNames();
+ obtainOperationIds();
- OperationDefinition operationDefinition = opMan.getOperationDefinition(subject, operationName);
+ OperationDefinition operationDefinition = opMan.getOperationDefinition(subject, operationId);
configurationDefinition = operationDefinition.getParametersConfigurationDefinition();
@@ -140,7 +139,7 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
return ALERT_NOTIFICATIONS;
}
- private void obtainOperationNames() {
+ private void obtainOperationIds() {
PropertySimple prop = alertParameters.getSimple(OperationsSender.RESOURCE_ID);
if (prop!=null)
@@ -152,7 +151,7 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
List<OperationDefinition> opDefs = opMan.findSupportedResourceOperations(subject, resId, false);
for (OperationDefinition def : opDefs) {
- operationNames.put(def.getDisplayName(),def.getId()); // TODO add more distinctive stuff in display
+ operationIds.put(def.getDisplayName(),def.getId()); // TODO add more distinctive stuff in display
}
}
}
@@ -205,30 +204,30 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
this.resourceName = resourceName;
}
- public Integer getOperationName() {
+ public Integer getOperationId() {
- if (operationName==null) {
- PropertySimple prop = alertParameters.getSimple(OperationsSender.OPERATION_NAME);
+ if (operationId ==null) {
+ PropertySimple prop = alertParameters.getSimple(OperationsSender.OPERATION_ID);
if (prop!=null)
- operationName = prop.getIntegerValue();
+ operationId = prop.getIntegerValue();
}
- return operationName;
+ return operationId;
}
- public void setOperationName(Integer operationName) {
- this.operationName = operationName;
+ public void setOperationId(Integer operationId) {
+ this.operationId = operationId;
}
- public Map<String, Integer> getOperationNames() {
+ public Map<String, Integer> getOperationIds() {
- obtainOperationNames();
+ obtainOperationIds();
- return operationNames;
+ return operationIds;
}
- public void setOperationNames(Map<String, Integer> operationNames) {
- this.operationNames = operationNames;
+ public void setOperationIds(Map<String, Integer> operationIds) {
+ this.operationIds = operationIds;
}
public ConfigurationDefinition getConfigurationDefinition() {
@@ -239,15 +238,11 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
}
public void setConfigurationDefinition(ConfigurationDefinition configurationDefinition) {
- log.info("set CD: " + configurationDefinition);
this.configurationDefinition = configurationDefinition;
}
public Configuration getConfiguration() {
-
return configuration;
-
-
}
public void setConfiguration(Configuration configuration) {
@@ -255,7 +250,7 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
log.info("setC: " + configuration);
}
- public String getNullConfigurationDefinitionMessage() {
+ public String getNullConfigurationDefinitionMessage() {
return "This operation does not take any parameters.";
}
@@ -280,5 +275,4 @@ log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " +
persistProperty(alertParameters, OperationsSender.TOKEN_MODE,tokenMode);
}
-
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
index 4359ad4..4f6c88e 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
@@ -18,9 +18,8 @@
*/
package org.rhq.enterprise.server.plugins.alertOperations;
+import java.util.List;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,7 +33,7 @@ import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.operation.OperationDefinition;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.exception.ScheduleException;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
@@ -51,7 +50,7 @@ public class OperationsSender extends AlertSender {
private final Log log = LogFactory.getLog(OperationsSender.class);
static final String RESOURCE_ID = "resourceId";
- static final String OPERATION_NAME = "operationName";
+ static final String OPERATION_ID = "operationName";
static final String USABLE = "usable";
protected static final String TOKEN_MODE = "tokenMode";
private static final String LITERAL = "literal";
@@ -62,8 +61,8 @@ public class OperationsSender extends AlertSender {
public SenderResult send(Alert alert) {
PropertySimple resProp = alertParameters.getSimple(RESOURCE_ID);
- PropertySimple opNameProp = alertParameters.getSimple(OPERATION_NAME);
- if (resProp==null || resProp.getIntegerValue() == null || opNameProp == null || opNameProp.getStringValue() == null)
+ PropertySimple opIdProp = alertParameters.getSimple(OPERATION_ID);
+ if (resProp==null || resProp.getIntegerValue() == null || opIdProp == null || opIdProp.getStringValue() == null)
return new SenderResult(ResultState.FAILURE, "Not enough parameters given");
PropertySimple usableProp = alertParameters.getSimple(USABLE);
@@ -71,11 +70,26 @@ public class OperationsSender extends AlertSender {
return new SenderResult(ResultState.FAILURE,"Not yet configured");
Integer resourceId = resProp.getIntegerValue();
- String opName = opNameProp.getStringValue();
+ Integer opId = opIdProp.getIntegerValue();
+
+ String opName = null;
OperationManagerLocal opMgr = LookupUtil.getOperationManager();
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO get real subject
+ List<OperationDefinition> opdefs = opMgr.findSupportedResourceOperations(subject,resourceId,false);
+ for (OperationDefinition opdef : opdefs ) {
+ if (opdef.getId() == opId) {
+ opName = opdef.getName();
+ break;
+ }
+ }
+
+ if (opName==null) {
+ return new SenderResult(ResultState.FAILURE, "No operation found ");
+ }
+
+
PropertySimple parameterConfigProp = alertParameters.getSimple(PARAMETERS_CONFIG);
Configuration parameters = null ;
if (parameterConfigProp!=null) {
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
index 4a6c0e6..98dcada 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
@@ -36,13 +36,13 @@
</h:panelGroup>
<h:panelGroup style="width:60%; vertical-align:top;" >
- <rich:panel rendered="#{not empty operationsBean.operationNames}">
+ <rich:panel rendered="#{not empty operationsBean.operationIds}">
Operations for: <h:outputText value=" #{operationsBean.resourceName}"/>
<br/>
- <h:selectOneMenu id="selectOperationMenu" value="#{operationsBean.operationName}">
- <f:selectItems value="#{operationsBean.operationNames}"/>
+ <h:selectOneMenu id="selectOperationMenu" value="#{operationsBean.operationId}">
+ <f:selectItems value="#{operationsBean.operationIds}"/>
</h:selectOneMenu>
<p/>
<h:commandButton id="opNameSubmit"
@@ -57,9 +57,9 @@
<p/>
<h:panelGroup style="width:100%">
<h:messages />
- <rich:panel rendered="#{not empty operationsBean.operationName}">
+ <rich:panel rendered="#{not empty operationsBean.operationId}">
<br/>
- Parameters for <h:outputText value=" #{operationsBean.operationName}"/>
+ Parameters for <h:outputText value=" #{operationsBean.operationId}"/>
<p/>
<h:selectOneMenu id="tokenModeMenu" value="#{operationsBean.tokenMode}">
<f:selectItem itemValue="literal" itemLabel="Literal"/>
commit 59776e2009c2e2b17ca45d5c88e6373def9da879
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Feb 23 09:23:23 2010 -0500
fix a couple invalid docs URLs
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties b/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties
index 571cf22..8132311 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties
+++ b/modules/enterprise/gui/portal-war/src/main/webapp-filtered/WEB-INF/classes/ApplicationResources.properties
@@ -88,7 +88,7 @@ common.field.value=Value
common.marketing.FeatureDisabled=This feature is unavailable, please contact sales to upgrade
-common.url.help=https://network.jboss.com/confluence/display/DOC/Users+Guide
+common.url.help=http://www.rhq-project.org/display/JOPR2
common.error.invalid.oid=OID specified is invalid, please enter OID in form of 1.2.3.4
@@ -2916,7 +2916,7 @@ software.common.InstallPreview.PatchTitle=Title
software.common.InstallPreview.StepDescription=Step Description
software.common.InstallPreview.ShortDescription=Short Description
software.common.InstallPreview.LongDescription=Detailed Description
-software.common.InstallPreview.TopMessage=Clicking the [Install] button will begin the execution of the steps listed below. Review each step carefully before proceeding with the update installation.<br/><ul><li>Prior to installing this update, if you have applied any one-off fixes to this instance, please check the update description to see that they are included in the fixes that make up this update. If they are not included then this update may overwrite the one-off fix and leave your instance in an unstable state.</li><li>When updating a JBoss instance that shares a common server configuration, follow the instructions documented in the wiki\: <a href\="https\://network.jboss.com/confluence/display/DOC/Installing+a+Patch" target\="_new">Installing a Patch</a>. Please contact support for more information.</li></ul>
+software.common.InstallPreview.TopMessage=Clicking the [Install] button will begin the execution of the steps listed below. Review each step carefully before proceeding with the update installation.<br/><ul><li>Prior to installing this update, if you have applied any one-off fixes to this instance, please check the update description to see that they are included in the fixes that make up this update. If they are not included then this update may overwrite the one-off fix and leave your instance in an unstable state.</li><li>When updating a JBoss instance that shares a common server configuration, follow the instructions documented in the wiki\: <a href\="http://www.rhq-project.org/display/JOPR2/Demos#Demos-ContentSubsystem" target\="_new">Installing a Patch</a>. Please contact support for more information.</li></ul>
software.common.InstallPreview.NotAllowedToInstall=This user doesn't have the appropriate rights to install an update. Only users that can control a resource may install an update.
software.common.ManualUninstall.TableTitle=Manual Update Uninstallation
commit b3c691dfd0f407658ba9004bbcbdda0c235404ef
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Feb 23 09:22:03 2010 -0500
fix regression in RSS feed template (https://bugzilla.redhat.com/show_bug.cgi?id=567636)
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp
index 59bb5d1..3831ebb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/common/RSSFormat.jsp
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="UTF-8"?>
<%@ page language="java" contentType="text/xml" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
- <repo>
+ <channel>
<title><c:out value="${rssFeed.title}"/></title>
<link><c:out value="${rssFeed.baseUrl}"/></link>
<description><fmt:message key="dashboard.template.title"/> <c:out value="${rssFeed.title}"/></description>
@@ -25,5 +25,6 @@
<guid><![CDATA[<c:out value="${item.guid}"/>]]></guid>
</item>
</c:forEach>
- </repo>
+ </channel>
</rss>
+
commit 7bdec1c039fbda0b202c078fe0c7be1507d95612
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 10:57:34 2010 +0100
Display, persist and use operation parameters.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
index 8b7c8d8..683057b 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
@@ -73,7 +73,12 @@ public class CustomContentUIBean {
* name of bean, but this class is not an "official" seam component.
*/
private void outjectBean(String name, CustomAlertSenderBackingBean bean) {
- Context pageContext = Contexts.getPageContext();
- pageContext.set(name, bean);
+
+ Context context = Contexts.getSessionContext();
+
+ CustomAlertSenderBackingBean csb = (CustomAlertSenderBackingBean) context.get(name);
+ if (csb ==null)
+ context.set(name,bean);
+
}
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
index 32e9f16..deabeae 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
@@ -25,38 +25,64 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.web.RequestParameter;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
* Backing bean for the operations alert sender
* @author Heiko W. Rupp
*/
-
+(a)Scope(ScopeType.PAGE)
public class OperationsBackingBean extends CustomAlertSenderBackingBean {
private final Log log = LogFactory.getLog(OperationsBackingBean.class);
private String resMode;
+ private String tokenMode;
Integer resId;
- private String operationName;
- private Map<String,String> operationNames = new HashMap<String,String>();
+ private Integer operationName;
+ private Map<String, Integer> operationNames = new HashMap<String, Integer>();
+ private String resourceName;
+
+
private ConfigurationDefinition configurationDefinition;
private Configuration configuration;
private static final String ALERT_NOTIFICATIONS = "ALERT_NOTIFICATIONS";
+ public OperationsBackingBean() {
+ log.info("new " + hashCode());
+ }
+
+ @Create
+ public void init() {
+ log.info("init");
+ }
+
+
public String selectResource() {
log.info("In select Resource, resId is " + resId + " resMode is " + resMode);
- if (resId != null)
+ if (resId != null) {
persistProperty(alertParameters, OperationsSender.RESOURCE_ID,resId);
+ cleanProperty(alertParameters,OperationsSender.OPERATION_NAME);
+ cleanProperty(alertParameters,OperationsSender.USABLE);
+
+ }
obtainOperationNames();
@@ -68,15 +94,47 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
public String selectOperation() {
log.info("In selectOperation, resId is " + resId + " opName is " + operationName);
- if (operationName != null )
+ if (operationName != null ) {
persistProperty(alertParameters, OperationsSender.OPERATION_NAME,operationName);
+ lookupConfiguration();
+ }
return ALERT_NOTIFICATIONS;
}
+ private void lookupConfiguration() {
+
+
+// log.info("getCD: " + configurationDefinition);
+ try {
+// Subject subject = EnterpriseFacesContextUtility.getSubject();
+ Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
+
+// int operationId = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("opId"));
+ OperationManagerLocal opMan = LookupUtil.getOperationManager();
+ obtainOperationNames();
+
+
+ OperationDefinition operationDefinition = opMan.getOperationDefinition(subject, operationName);
+ configurationDefinition = operationDefinition.getParametersConfigurationDefinition();
+
+
+ // call a SLSB method to get around lazy initialization of configDefs and configTemplates
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+ configuration = configurationManager.getConfigurationFromDefaultTemplate(configurationDefinition);
+// Configuration newConfiguration = configuration.deepCopy(false);
+log.info("gConfig: " + configuration + ", " + configuration.hashCode() + ", " + configuration.getSimpleValue("detailedDiscovery","-unset-"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
public String useConfiguration() {
- log.info("In useConfiguration");
+ log.info("In useConfiguration, Configuration is " + configuration );
+ // COnfiguration should be valid here ...
+ super.persistConfiguration(configuration);
+ persistProperty(alertParameters,OperationsSender.PARAMETERS_CONFIG,configuration.getId());
persistProperty(alertParameters, OperationsSender.USABLE,true);
return ALERT_NOTIFICATIONS;
@@ -94,7 +152,7 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
List<OperationDefinition> opDefs = opMan.findSupportedResourceOperations(subject, resId, false);
for (OperationDefinition def : opDefs) {
- operationNames.put(def.getDisplayName(),def.getName()); // TODO add more distinctive stuff in display
+ operationNames.put(def.getDisplayName(),def.getId()); // TODO add more distinctive stuff in display
}
}
}
@@ -107,6 +165,7 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
public void setResMode(String resMode) {
this.resMode = resMode;
+ log.info("setResMode: " + resMode);
}
public Integer getResId() {
@@ -122,47 +181,104 @@ public class OperationsBackingBean extends CustomAlertSenderBackingBean {
public void setResId(Integer resId) {
this.resId = resId;
+ log.info("Set resid " + resId);
+ if (resId!=null) {
+ persistProperty(alertParameters,OperationsSender.RESOURCE_ID,resId);
+ }
}
- public String getOperationName() {
+ public String getResourceName() {
+ if (resId==null)
+ getResId();
+
+ if (resId!=null) {
+ ResourceManagerLocal resMgr = LookupUtil.getResourceManager();
+ Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
+ Resource res = resMgr.getResource(subject,resId);
+
+ resourceName = res.getName() + " (" + res.getResourceType().getName() + ")";
+ }
+ return resourceName;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public Integer getOperationName() {
if (operationName==null) {
PropertySimple prop = alertParameters.getSimple(OperationsSender.OPERATION_NAME);
if (prop!=null)
- operationName = prop.getStringValue();
+ operationName = prop.getIntegerValue();
}
return operationName;
}
- public void setOperationName(String operationName) {
+ public void setOperationName(Integer operationName) {
this.operationName = operationName;
}
- public Map<String,String> getOperationNames() {
+ public Map<String, Integer> getOperationNames() {
obtainOperationNames();
return operationNames;
}
- public void setOperationNames(Map<String,String> operationNames) {
+ public void setOperationNames(Map<String, Integer> operationNames) {
this.operationNames = operationNames;
}
public ConfigurationDefinition getConfigurationDefinition() {
return configurationDefinition;
+
+
+
}
public void setConfigurationDefinition(ConfigurationDefinition configurationDefinition) {
+ log.info("set CD: " + configurationDefinition);
this.configurationDefinition = configurationDefinition;
}
public Configuration getConfiguration() {
+
return configuration;
+
+
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
+ log.info("setC: " + configuration);
}
+
+ public String getNullConfigurationDefinitionMessage() {
+ return "This operation does not take any parameters.";
+ }
+
+ public String getNullConfigurationMessage() {
+ return "This operation parameters definition has not been initialized.";
+ }
+
+ public String getTokenMode() {
+ if (tokenMode==null) {
+ PropertySimple prop = alertParameters.getSimple(OperationsSender.TOKEN_MODE);
+ if (prop!=null)
+ tokenMode = prop.getStringValue();
+ }
+
+ return tokenMode;
+ }
+
+ public void setTokenMode(String tokenMode) {
+ this.tokenMode = tokenMode;
+ log.info("token mode" + tokenMode);
+
+ persistProperty(alertParameters, OperationsSender.TOKEN_MODE,tokenMode);
+ }
+
+
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
index 4fa9bba..4359ad4 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
@@ -18,14 +18,24 @@
*/
package org.rhq.enterprise.server.plugins.alertOperations;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Scope;
+
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.exception.ScheduleException;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.operation.ResourceOperationSchedule;
@@ -36,12 +46,17 @@ import org.rhq.enterprise.server.util.LookupUtil;
* Alert sender that triggers an operation on the resource
* @author Heiko W. Rupp
*/
+@Scope(value = ScopeType.PAGE)
public class OperationsSender extends AlertSender {
private final Log log = LogFactory.getLog(OperationsSender.class);
static final String RESOURCE_ID = "resourceId";
static final String OPERATION_NAME = "operationName";
static final String USABLE = "usable";
+ protected static final String TOKEN_MODE = "tokenMode";
+ private static final String LITERAL = "literal";
+ private static final String INTERPRETED = "interpreted";
+ public static final String PARAMETERS_CONFIG = "parametersConfig";
@Override
public SenderResult send(Alert alert) {
@@ -52,7 +67,7 @@ public class OperationsSender extends AlertSender {
return new SenderResult(ResultState.FAILURE, "Not enough parameters given");
PropertySimple usableProp = alertParameters.getSimple(USABLE);
- if (usableProp==null || usableProp.getBooleanValue()== null || usableProp.getBooleanValue() == false)
+ if (usableProp==null || usableProp.getBooleanValue()== null || !usableProp.getBooleanValue())
return new SenderResult(ResultState.FAILURE,"Not yet configured");
Integer resourceId = resProp.getIntegerValue();
@@ -61,17 +76,53 @@ public class OperationsSender extends AlertSender {
OperationManagerLocal opMgr = LookupUtil.getOperationManager();
Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO get real subject
+ PropertySimple parameterConfigProp = alertParameters.getSimple(PARAMETERS_CONFIG);
+ Configuration parameters = null ;
+ if (parameterConfigProp!=null) {
+ Integer paramId = parameterConfigProp.getIntegerValue();
+ if (paramId!=null) {
+ ConfigurationManagerLocal cmgr = LookupUtil.getConfigurationManager();
+ parameters = cmgr.getConfiguration(subject,paramId);
+ }
+ }
+
+
+ String tokenMode = alertParameters.getSimpleValue(TOKEN_MODE, LITERAL);
+
+ /*
+ * If we have parameters and the user wants tokens to be interpreted, then loop
+ * over the parameters and do token replacement.
+ */
+ if (parameters!=null && tokenMode.equals(INTERPRETED)) {
+ Map<String,PropertySimple> propsMap = parameters.getSimpleProperties();
+ if (!propsMap.isEmpty()) {
+ TokenReplacer tr = new TokenReplacer(alert);
+ for (PropertySimple prop : propsMap.values()) {
+ String tmp = prop.getStringValue();
+ tmp = tr.replaceTokens(tmp);
+ prop.setStringValue(tmp);
+ }
+ }
+ }
+
+
+
+ /*
+ * Now fire off the operation with no delay and no repetition.
+ */
ResourceOperationSchedule sched;
try {
- sched = opMgr.scheduleResourceOperation(subject, resourceId, opName, 0, 0, 0, 0, null,
+ sched = opMgr.scheduleResourceOperation(subject, resourceId, opName, 0, 0, 0, 0, parameters,
"Alert operation for " + alert.getAlertDefinition().getName());
} catch (ScheduleException e) {
return new SenderResult(ResultState.FAILURE, "Scheduling of operation " + opName + " on resource " + resourceId + " failed: " + e.getMessage());
}
- // TODO evaluate retuen of schedule() call and defer, so we can leter check
- // If op sending was successfull
+ // If op sending was successful
return new SenderResult(ResultState.SUCCESS, "Scheduled operation " + opName + " on resource " + resourceId + " with jobId " + sched.getJobId() );
}
+
+
+
}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
index 1fd74ad..4a6c0e6 100644
--- a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
@@ -29,12 +29,18 @@
<h:commandButton id="resourceIdSubmit"
value="Select"
type="submit"
- action="#{operationsBean.selectResource}" />
+ action="#{operationsBean.selectResource}"
+ styleClass="buttonmed"
+ />
</rich:panel>
</h:panelGroup>
- <h:panelGroup style="width:60%">
+ <h:panelGroup style="width:60%; vertical-align:top;" >
<rich:panel rendered="#{not empty operationsBean.operationNames}">
+
+ Operations for: <h:outputText value=" #{operationsBean.resourceName}"/>
+ <br/>
+
<h:selectOneMenu id="selectOperationMenu" value="#{operationsBean.operationName}">
<f:selectItems value="#{operationsBean.operationNames}"/>
</h:selectOneMenu>
@@ -42,31 +48,40 @@
<h:commandButton id="opNameSubmit"
value="Select"
type="submit"
- action="#{operationsBean.selectOperation}" />
+ action="#{operationsBean.selectOperation}"
+ styleClass="buttonmed"
+ />
</rich:panel>
</h:panelGroup>
</h:panelGrid>
<p/>
<h:panelGroup style="width:100%">
- <h:outputText value="3rd panel : "/>
- <h:outputText value="#{operationsBean.operationName}"/>
- <br/>
+ <h:messages />
<rich:panel rendered="#{not empty operationsBean.operationName}">
+ <br/>
+ Parameters for <h:outputText value=" #{operationsBean.operationName}"/>
+ <p/>
+ <h:selectOneMenu id="tokenModeMenu" value="#{operationsBean.tokenMode}">
+ <f:selectItem itemValue="literal" itemLabel="Literal"/>
+ <f:selectItem itemValue="interpreted" itemLabel="Interpreted"/>
+ </h:selectOneMenu>
+ <p/>
<onc:config configurationDefinition="#{operationsBean.configurationDefinition}"
configuration="#{operationsBean.configuration}"
- nullConfigurationDefinitionMessage="NUll configuration definition"
- nullConfigurationMessage="null configuration"
+ nullConfigurationDefinitionMessage="#{operationsBean.nullConfigurationDefinitionMessage}"
+ nullConfigurationMessage="#{nullConfigurationMessage}"
nullConfigurationStyle="InfoBlock"
-
- id="opParamConfiguration"
+ readOnly="false"
/>
<p/>
<h:commandButton id="opParamSubmit"
value="Set"
type="submit"
- action="#{operationsBean.useConfiguration}" />
+ action="#{operationsBean.useConfiguration}"
+ styleClass="buttonmed"
+ />
</rich:panel>
</h:panelGroup>
</body>
-</html>
\ No newline at end of file
+</html>
commit b196e883688008615778ad6eb73fb94caff12015
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 23 10:56:59 2010 +0100
Implement code for token replacement
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
new file mode 100644
index 0000000..bcd7570
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/Token.java
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.EnumSet;
+
+/**
+ * Tokens that can be replaced in
+ * @author Heiko W. Rupp
+ */
+public enum Token {
+
+ // Alert related tokens
+ ALERT_ID(TokenClass.ALERT, "id"),
+ ALERT_URL(TokenClass.ALERT, "url"),
+
+ // resource that triggered the alert related tokens
+ RESOURCE_ID(TokenClass.RESOURCE, "id"),
+ RESOURCE_NAME(TokenClass.RESOURCE, "name"),
+
+
+ // resource the operation is run on related tokens
+ TRESOURCE_ID(TokenClass.TARGET_RESOURCE, "id"),
+ TRESOURCE_NAME(TokenClass.TARGET_RESOURCE, "name"),
+
+
+ // only for testing
+ TEST_ECHO(TokenClass.TEST,"echo"),
+ TEST_FIX(TokenClass.TEST,"fix")
+
+ ;
+
+
+ private String text;
+
+ private Token(TokenClass tc, String text) {
+
+ this.text = tc.getText() + "." + text;
+ }
+
+ /**
+ * Return the token that matches the input text or null if not found.
+ * The token delimiters need to be already stripped from the input
+ * @param input a token text like <i>alert.id</i>, which would return the
+ * <i>ALERT_ID</i> token.
+ * @return The matching token or null if not found
+ */
+ public static Token getByText(String input) {
+ EnumSet<Token> es = EnumSet.allOf(Token.class);
+ for (Token t : es) {
+ if (t.text.equals(input))
+ return t;
+ }
+ return null;
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java
new file mode 100644
index 0000000..5125a72
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenClass.java
@@ -0,0 +1,59 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.EnumSet;
+
+/**
+ * Class a @See{Token} can be in.
+ * @author Heiko W. Rupp
+ */
+public enum TokenClass {
+
+ ALERT("alert"),
+ RESOURCE("resource"),
+ TARGET_RESOURCE("targetResource"),
+ TEST("test");
+
+ private String text;
+
+ private TokenClass(String text) {
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Return the tokenclass that matches the input text or null if not found.
+ * The token delimiters need to be already stripped from the input
+ * @param input a token text like <i>alert</i>, which would return the
+ * <i>ALERT</i> token class.
+ * @return The matching token class or null if not found
+ */
+ public static TokenClass getByText(String input) {
+ EnumSet<TokenClass> es = EnumSet.allOf(TokenClass.class);
+ for (TokenClass t : es) {
+ if (t.text.equals(input))
+ return t;
+ }
+ return null;
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java
new file mode 100644
index 0000000..0b230b4
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacer.java
@@ -0,0 +1,178 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.resource.Resource;
+
+/**
+ * Helper to replace tokens by their values
+ * @author Heiko W. Rupp
+ */
+public class TokenReplacer {
+
+ private final Log log = LogFactory.getLog(TokenReplacer.class);
+ private static final String NOT_YET_IMPLEMENTED = " - not yet implemented -";
+ protected static final String THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG = "TheQuickBrownFoxJumpsOverTheLazyDOg";
+ private Alert alert;
+ private Pattern pattern;
+
+ public TokenReplacer(Alert alert) {
+ this.alert = alert;
+ pattern = Pattern.compile("<%\\s*([a-z]+\\.[a-z0-9]+)\\s*%>");
+ }
+
+ /**
+ * Replace all tokens on the input line. If no tokens are found the input is returned.
+ * Tokens have the form '<i><% class.sub %></i>'
+ * @param input a line of text
+ * @return input with tokens replaced.
+ * @see org.rhq.enterprise.server.plugins.alertOperations.Token
+ * @see org.rhq.enterprise.server.plugins.alertOperations.TokenClass
+ */
+ public String replaceTokens(String input) {
+
+ String work = input;
+ Matcher matcher = pattern.matcher(work);
+ if (!matcher.find()) {
+ log.warn("No tokens found in " + input);
+ return input;
+ }
+ matcher.reset();
+
+ do {
+// System.out.println(input);
+ matcher = pattern.matcher(work);
+ if (!matcher.find()) {
+ break;
+ }
+// System.out.println(matcher.regionStart() + ":" + matcher.regionEnd() + input.substring(matcher.regionStart(),matcher.regionEnd()));
+// System.out.println(matcher.group(1));
+ String replacement = replaceToken(matcher.group(1) );
+ String s = matcher.replaceFirst(replacement);
+// System.out.println(s);
+ work = s;
+
+// System.out.println("----");
+ } while (true);
+
+ return work;
+ }
+
+
+
+ /**
+ * Replace the token string passed (without the token delimiters ) with the actual value
+ * @param tokenString Input like alert.id
+ * @return replacement string or the input if the token was not valid.
+ */
+ public String replaceToken(String tokenString) {
+
+ // Ok, we have at least one token. Now split the tokenString and loop over the tokens
+
+ if (!tokenString.contains("."))
+ return tokenString;
+
+ String tmp = tokenString.substring(0, tokenString.indexOf("."));
+ TokenClass tc = TokenClass.getByText(tmp);
+ if (tc==null) {
+ log.warn("Unknown token class in [" + tokenString + "], not replacing tokens");
+ return tokenString;
+ }
+
+ Token token = Token.getByText(tokenString);
+ if (token == null) {
+ log.warn("No known token found in [" + tokenString + "], not replacing token");
+ return tokenString;
+ }
+ String ret = null;
+ switch (tc) {
+ case ALERT:
+ ret = replaceAlertToken(token,alert);
+ break;
+ case RESOURCE:
+ ret = replaceResourceToken(token,alert.getAlertDefinition().getResource());
+ break;
+ case TARGET_RESOURCE:
+ Resource resource = null; // TODO
+ ret = replaceTargetResourceToken(token, resource);
+ break;
+ case TEST:
+ switch (token) {
+ case TEST_ECHO:
+ ret = tokenString;
+ break;
+ case TEST_FIX:
+ ret = THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG;
+ break;
+ default:
+ ret = NOT_YET_IMPLEMENTED;
+ }
+ break;
+ }
+ return ret;
+ }
+
+ private String replaceAlertToken(Token token, Alert alert) {
+
+ switch (token) {
+ case ALERT_ID:
+ return String.valueOf(alert.getId());
+ case ALERT_URL:
+ return NOT_YET_IMPLEMENTED;
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+
+ }
+
+ private String replaceResourceToken(Token token, Resource resource) {
+
+ switch (token) {
+ case RESOURCE_ID:
+ return String.valueOf(resource.getId());
+ case RESOURCE_NAME:
+ return resource.getName();
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+ }
+
+ private String replaceTargetResourceToken(Token token, Resource resource) {
+
+ switch (token) {
+ case TRESOURCE_ID:
+ return String.valueOf(resource.getId());
+ case TRESOURCE_NAME:
+ return resource.getName();
+
+ default:
+ return NOT_YET_IMPLEMENTED;
+ }
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java b/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java
new file mode 100644
index 0000000..f41fc85
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/test/java/org/rhq/enterprise/server/plugins/alertOperations/TokenReplacementTest.java
@@ -0,0 +1,135 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.resource.Resource;
+
+/**
+ * // TODO: Document this
+ * @author Heiko W. Rupp
+ */
+@Test
+public class TokenReplacementTest {
+
+ private final Log log = LogFactory.getLog(TokenReplacementTest.class);
+ private static final String TEST_ECHO = "test.echo";
+ private static final String FOO_BAR = "fooBar";
+ private static final String FOO_DOT_BAR = "foo.bar";
+ private static final String ALERT_BAR = "alert.bar";
+
+ public void testSimpleReplacement() throws Exception {
+
+ Alert al = new Alert();
+ TokenReplacer tr = new TokenReplacer(al);
+
+
+ String res = tr.replaceToken("test.fix");
+ assert res != null;
+ assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
+
+ res = tr.replaceToken(TEST_ECHO);
+ assert res != null;
+ assert res.equals(TEST_ECHO);
+
+ res = tr.replaceToken("alert.id");
+ assert res != null;
+ assert res.equals("0");
+
+ Resource r = new Resource(1234);
+ r.setName("A resource");
+ AlertDefinition def = new AlertDefinition();
+ def.setResource(r);
+ al = new Alert(def, System.currentTimeMillis());
+ tr = new TokenReplacer(al);
+
+ res = tr.replaceToken("resource.id");
+ assert "1234".equals(res);
+ res = tr.replaceToken("resource.name");
+ assert "A resource".equals(res);
+ }
+
+ public void testInvalidTokenString() {
+
+ Alert al = new Alert();
+ TokenReplacer tr = new TokenReplacer(al);
+
+
+ String res = tr.replaceToken(FOO_BAR);
+ assert res != null;
+ assert res.equals(FOO_BAR);
+
+ res = tr.replaceToken(FOO_DOT_BAR);
+ assert res != null;
+ assert res.equals(FOO_DOT_BAR);
+
+ res = tr.replaceToken(ALERT_BAR);
+ assert res != null;
+ assert res.equals(ALERT_BAR);
+
+ }
+
+ public void testFullTokenSimple() {
+
+ Alert al = new Alert();
+ TokenReplacer tr = new TokenReplacer(al);
+
+
+ String res = tr.replaceTokens("<%test.fix%>");
+ assert res != null;
+ assert !res.equals("<%test.fix%>") : "Res was " + res;
+ assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG);
+
+ String TF2 = "<% test.fix %>";
+ res = tr.replaceTokens(TF2);
+ assert res != null;
+ assert !res.equals(TF2) : "Res was " + res;
+
+ String TF3 = "<% test.fix %>";
+ res = tr.replaceTokens(TF3);
+ assert res != null;
+ assert !res.equals(TF3) : "Res was " + res;
+
+ String TF4 = "<% test.fix%> xXx <% test.echo%>";
+ res = tr.replaceTokens(TF4);
+ assert res != null;
+ assert !res.equals(TF4) : "Res was " + res;
+
+ res = tr.replaceTokens(FOO_BAR);
+ assert res != null;
+ assert res.equals(FOO_BAR) : "Res was " + res;
+
+ Resource r = new Resource(1234);
+ r.setName("A resource");
+ AlertDefinition def = new AlertDefinition();
+ def.setResource(r);
+ al = new Alert(def, System.currentTimeMillis());
+
+ tr = new TokenReplacer(al);
+ res = tr.replaceTokens("<% test.fix%><%resource.id%>");
+ assert res!=null;
+ assert res.equals(TokenReplacer.THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG+"1234");
+ }
+
+}
commit 2325fa6314a7ebcbf1d932fb42e9f9559e1d079b
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 03:02:28 2010 -0500
add auto-completion capability for saved search manager to the CLI
diff --git a/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java b/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
index acafe6f..a1a5b38 100644
--- a/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
+++ b/modules/enterprise/remoting/client-api/src/main/java/org/rhq/enterprise/client/RemoteClient.java
@@ -54,6 +54,7 @@ import org.rhq.enterprise.server.resource.ResourceFactoryManagerRemote;
import org.rhq.enterprise.server.resource.ResourceManagerRemote;
import org.rhq.enterprise.server.resource.ResourceTypeManagerRemote;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerRemote;
+import org.rhq.enterprise.server.search.SavedSearchManagerRemote;
import org.rhq.enterprise.server.support.SupportManagerRemote;
import org.rhq.enterprise.server.system.ServerVersion;
import org.rhq.enterprise.server.system.SystemManagerRemote;
@@ -94,6 +95,7 @@ public class RemoteClient {
ResourceGroupManager(ResourceGroupManagerRemote.class), //
ResourceTypeManager(ResourceTypeManagerRemote.class), //
RoleManager(RoleManagerRemote.class), //
+ SavedSearchManager(SavedSearchManagerRemote.class), //
SubjectManager(SubjectManagerRemote.class), //
SupportManager(SupportManagerRemote.class), //
SystemManager(SystemManagerRemote.class) //
commit 9bfad0211e66635e09d02d8959a81db33f6175b7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 02:51:14 2010 -0500
add LookupUtil method to retrieve the saved search manager from the UI layer
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
index dc9ae11..c21526a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/LookupUtil.java
@@ -165,6 +165,8 @@ import org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerBean;
import org.rhq.enterprise.server.resource.metadata.ResourceMetadataManagerLocal;
import org.rhq.enterprise.server.scheduler.SchedulerBean;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
+import org.rhq.enterprise.server.search.SavedSearchManagerBean;
+import org.rhq.enterprise.server.search.SavedSearchManagerLocal;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerBean;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerLocal;
import org.rhq.enterprise.server.subsystem.ConfigurationSubsystemManagerBean;
@@ -516,6 +518,10 @@ public final class LookupUtil {
return lookupLocal(SchedulerBean.class);
}
+ public static SavedSearchManagerLocal getSavedSearchManager() {
+ return lookupLocal(SavedSearchManagerBean.class);
+ }
+
public static SubjectManagerLocal getSubjectManager() {
return lookupLocal(SubjectManagerBean.class);
}
commit 7b68ec1372bd5af42793b5d15020e7b2f66bb931
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 02:49:08 2010 -0500
add criteria-based retrieval for the saved search manager
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
new file mode 100644
index 0000000..bd70b6f
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
@@ -0,0 +1,142 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.criteria;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+
+import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.core.domain.search.SearchContext;
+import org.rhq.core.domain.util.PageOrdering;
+
+/**
+ * @author Joseph Marques
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@SuppressWarnings("unused")
+public class SavedSearchCriteria extends Criteria {
+ public static final long serialVersionUID = 1L;
+
+ private Integer filterId;
+ private SearchContext filterContext;
+ private String filterName;
+ private String filterDescription;
+ private String filterPattern;
+ private Long filterLastComputeTimeMin;
+ private Long filterLastComputeTimeMax;
+ private Long filterResultCountMin;
+ private Long filterResultCountMax;
+ private Integer filterSubjectId;
+ private Boolean filterGlobal;
+
+ private boolean fetchSubject;
+
+ private PageOrdering sortContext;
+ private PageOrdering sortName;
+ private PageOrdering sortLastComputeTime;
+ private PageOrdering sortResultCount;
+ private PageOrdering sortGlobal;
+
+ public SavedSearchCriteria() {
+ super(SavedSearch.class);
+
+ filterOverrides.put("lastComputeTimeMin", "lastComputeTime >= ?");
+ filterOverrides.put("lastComputeTimeMax", "lastComputeTime <= ?");
+ filterOverrides.put("resultCountMin", "resultCount >= ?");
+ filterOverrides.put("resultCountMax", "resultCount <= ?");
+ }
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ public void addFilterSearchContext(SearchContext filterContext) {
+ this.filterContext = filterContext;
+ }
+
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
+ }
+
+ public void addFilterDescription(String filterDescription) {
+ this.filterDescription = filterDescription;
+ }
+
+ public void addFilterPattern(String filterPattern) {
+ this.filterPattern = filterPattern;
+ }
+
+ public void addFilterResultCountMin(Long filterResultCountMin) {
+ this.filterResultCountMin = filterResultCountMin;
+ }
+
+ public void addFilterResultCountMax(Long filterResultCountMax) {
+ this.filterResultCountMax = filterResultCountMax;
+ }
+
+ public void addFilterLastComputeTimeMin(Long filterLastComputeTimeMin) {
+ this.filterLastComputeTimeMin = filterLastComputeTimeMin;
+ }
+
+ public void addFilterLastComputeTimeMax(Long filterLastComputeTimeMax) {
+ this.filterLastComputeTimeMax = filterLastComputeTimeMax;
+ }
+
+ public void addFilterSubjectId(Integer filterSubjectId) {
+ this.filterSubjectId = filterSubjectId;
+ }
+
+ public void addFilterGlobal(Boolean filterGlobal) {
+ this.filterGlobal = filterGlobal;
+ }
+
+ public void setFetchSubject(boolean fetchSubject) {
+ this.fetchSubject = fetchSubject;
+ }
+
+ public void addSortContext(PageOrdering sortContext) {
+ addSortField("context");
+ this.sortContext = sortContext;
+ }
+
+ public void addSortName(PageOrdering sortName) {
+ addSortField("name");
+ this.sortName = sortName;
+ }
+
+ public void addSortLastComputeTime(PageOrdering sortLastComputeTime) {
+ addSortField("lastComputeTime");
+ this.sortLastComputeTime = sortLastComputeTime;
+ }
+
+ public void addSortResultCount(PageOrdering sortResultCount) {
+ addSortField("resultCount");
+ this.sortResultCount = sortResultCount;
+ }
+
+ public void addSortGlobal(PageOrdering sortGlobal) {
+ addSortField("global");
+ this.sortGlobal = sortGlobal;
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
index f672ac7..1485197 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
@@ -24,10 +24,14 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.SavedSearchCriteria;
import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
+import org.rhq.enterprise.server.util.CriteriaQueryRunner;
/**
* This bean provides functionality to CRUD saved search patterns.
@@ -79,6 +83,18 @@ public class SavedSearchManagerBean implements SavedSearchManagerLocal /* local
return savedSearch;
}
+ public PageList<SavedSearch> findSavedSearchesByCriteria(Subject subject, SavedSearchCriteria criteria) {
+ CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
+
+ if (!authorizationManager.isInventoryManager(subject)) {
+ generator.setAuthorizationCustomConditionFragment("(subject.id=" + subject.getId() + " OR global=true)");
+ }
+
+ CriteriaQueryRunner<SavedSearch> queryRunner = new CriteriaQueryRunner<SavedSearch>(criteria, generator,
+ entityManager);
+ return queryRunner.execute();
+ }
+
private void validateManipulatePermission(Subject subject, SavedSearch savedSearch) {
if (savedSearch.isGlobal()) {
if (!authorizationManager.isInventoryManager(subject)) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
index a1615ec..ffd4255 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
@@ -25,7 +25,9 @@ import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.criteria.SavedSearchCriteria;
import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.system.ServerVersion;
@@ -99,4 +101,18 @@ public interface SavedSearchManagerRemote {
public SavedSearch getSavedSearchById( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "savedSearchId") int savedSearchId);
+
+ /**
+ * Returns the {@link PageList} of {@link SavedSearch} entities that match the criteria filters that are visible
+ * to the user
+ *
+ * @param subject the logged in user requesting the {@link PageList} of {@link SavedSearch} to be returned
+ * @param criteria the {@link SavedSearchCriteria} object that will filter the returned results
+ *
+ * @return the {@link PageList} of {@link SavedSearch} entities that match the criteria filters, an empty list
+ * will be returned if no results were found or none matches the given filters
+ */
+ public PageList<SavedSearch> findSavedSearchesByCriteria( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "criteria") SavedSearchCriteria criteria);
}
commit 8bee964f9c9fb494fc08a3baaa307361d826b445
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 02:48:32 2010 -0500
enhance the CriteriaQueryGenerator to allow more flexible authorization:
support users to set a completely arbitrary authorization fragment, which
will be inserted into the list of conditions for the generated query
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 9c62eed..bb0c072 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -58,13 +58,14 @@ public final class CriteriaQueryGenerator {
public enum AuthorizationTokenType {
RESOURCE, // specifies the resource alias to join on for standard res-group-role-subject authorization checking
- GROUP; // specifies the group alias to join on for standard group-role-subject authorization checking
+ GROUP; // specifies the group alias to join on for standard group-role-subject authorization checking
}
private Criteria criteria;
private String authorizationJoinFragment;
private String authorizationPermsFragment;
+ private String authorizationCustomConditionFragment;
private int authorizationSubjectId;
private String alias;
@@ -89,6 +90,10 @@ public final class CriteriaQueryGenerator {
this.alias = aliasBuilder.toString();
}
+ public void setAuthorizationCustomConditionFragment(String fragment) {
+ this.authorizationCustomConditionFragment = fragment;
+ }
+
public void setAuthorizationResourceFragment(AuthorizationTokenType type, int subjectId) {
String defaultFragment = null;
if (type == AuthorizationTokenType.RESOURCE) {
@@ -260,6 +265,16 @@ public final class CriteriaQueryGenerator {
}
}
+ if (authorizationCustomConditionFragment != null) {
+ if (firstCrit) {
+ firstCrit = false;
+ } else {
+ // always want AND for security, regardless of conjunctiveFragment
+ results.append(NL).append(" AND ");
+ }
+ results.append(this.authorizationCustomConditionFragment);
+ }
+
if (countQuery == false) {
boolean overridden = true;
PageControl pc = criteria.getPageControlOverrides();
commit d065f478b829887eda067308a10f98edef113b66
Author: Joseph Marques <joseph(a)redhat.com>
Date: Tue Feb 23 00:50:35 2010 -0500
initial SLSB support basic CRUD, with security restrictions, for saved search patterns
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
new file mode 100644
index 0000000..f672ac7
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
@@ -0,0 +1,104 @@
+/*
+ * 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.search;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.authz.PermissionException;
+
+/**
+ * This bean provides functionality to CRUD saved search patterns.
+ *
+ * @author Joseoh Marques
+ */
+@Stateless
+public class SavedSearchManagerBean implements SavedSearchManagerLocal /* local already implements remote interface */{
+
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ private EntityManager entityManager;
+
+ @EJB
+ private AuthorizationManagerLocal authorizationManager;
+
+ /**
+ * @see SavedSearchManagerRemote#createSavedSearch(Subject, SavedSearch)
+ */
+ public void createSavedSearch(Subject subject, SavedSearch savedSearch) {
+ validateManipulatePermission(subject, savedSearch);
+ entityManager.persist(savedSearch);
+ return;
+ }
+
+ /**
+ * @see SavedSearchManagerRemote#updateSavedSearch(Subject, SavedSearch)
+ */
+ public void updateSavedSearch(Subject subject, SavedSearch savedSearch) {
+ validateManipulatePermission(subject, savedSearch);
+ entityManager.merge(savedSearch);
+ return;
+ }
+
+ /**
+ * @see SavedSearchManagerRemote#deleteSavedSearch(Subject, int)
+ */
+ public void deleteSavedSearch(Subject subject, int savedSearchId) {
+ SavedSearch savedSearch = entityManager.find(SavedSearch.class, savedSearchId);
+ validateManipulatePermission(subject, savedSearch);
+ entityManager.remove(savedSearch);
+ }
+
+ /**
+ * @see SavedSearchManagerRemote#getSavedSearchById(Subject, int)
+ */
+ public SavedSearch getSavedSearchById(Subject subject, int savedSearchId) {
+ SavedSearch savedSearch = entityManager.find(SavedSearch.class, savedSearchId);
+ validateReadPermission(subject, savedSearch);
+ return savedSearch;
+ }
+
+ private void validateManipulatePermission(Subject subject, SavedSearch savedSearch) {
+ if (savedSearch.isGlobal()) {
+ if (!authorizationManager.isInventoryManager(subject)) {
+ throw new PermissionException("Only inventory managers can manipulate global saved searches");
+ }
+ // note: inventory managers can modify any saved search pattern, not just their own
+ } else {
+ if (subject.equals(savedSearch.getSubject())) {
+ throw new PermissionException("Users without inventory manager permission "
+ + "can only manipulate their own saved searches");
+ }
+ }
+ }
+
+ private void validateReadPermission(Subject subject, SavedSearch savedSearch) {
+ if (!savedSearch.isGlobal()) {
+ if (subject.equals(savedSearch.getSubject())) {
+ throw new PermissionException("Users without inventory manager permission "
+ + "can only view their own or global saved saved searches");
+ }
+ }
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerLocal.java
new file mode 100644
index 0000000..7ced552
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerLocal.java
@@ -0,0 +1,31 @@
+/*
+ * 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.search;
+
+import javax.ejb.Local;
+
+/**
+ * The local interface to the SavedSearchManager.
+ *
+ * @author Joseph Marques
+ */
+@Local
+public interface SavedSearchManagerLocal extends SavedSearchManagerRemote {
+ // there are currently no methods in the local interface that do not exist in the remote interface
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
new file mode 100644
index 0000000..a1615ec
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerRemote.java
@@ -0,0 +1,102 @@
+/*
+ * 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.search;
+
+import javax.ejb.Remote;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.system.ServerVersion;
+
+/**
+ * The remote interface to the SavedSearchManager.
+ *
+ * @author Joseph Marques
+ */
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+@WebService(targetNamespace = ServerVersion.namespace)
+@Remote
+public interface SavedSearchManagerRemote {
+
+ /**
+ * Persisted a new {@link SavedSearch} with the given primary key
+ *
+ * @param subject the logged in user requesting the {@link SavedSearch} deletion
+ * @param savedSearchId the primary key of the {@link SavedSearch} to be deleted
+ *
+ * @throws PermissionException if the user is not authorized to create the {@link SavedSearch}. Only inventory
+ * managers can create global saved searches. Regular users can only create {@link SavedSearch}es against
+ * their own accounts.
+ */
+ @WebMethod
+ public void createSavedSearch( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "savedSearch") SavedSearch savedSearch);
+
+ /**
+ * Saves all changes to the passed {@link SavedSearch} database, correlating it to the record already
+ * persisted with the same primary key
+ *
+ * @param subject the logged in user requesting the {@link SavedSearch} persisted modification
+ * @param savedSearchId the {@link SavedSearch} which will have its modifications persisted
+ *.
+ * @throws PermissionException if the user is not authorized to modify the {@link SavedSearch}. Only inventory
+ * managers can update global saved searches. Regular users can only update {@link SavedSearch}es from
+ * their own accounts.
+ */
+ @WebMethod
+ public void updateSavedSearch( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "savedSearch") SavedSearch savedSearch);
+
+ /**
+ * Deletes the {@link SavedSearch} with the given primary key
+ *
+ * @param subject the logged in user requesting the {@link SavedSearch} deletion
+ * @param savedSearchId the primary key of the {@link SavedSearch} to be deleted
+ *
+ * @throws PermissionException if the user is not authorized to delete the {@link SavedSearch}. Only inventory
+ * managers can delete global saved searches. Regular users can only delete {@link SavedSearch}es from
+ * their own accounts.
+ */
+ @WebMethod
+ public void deleteSavedSearch( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "savedSearchId") int savedSearchId);
+
+ /**
+ * Returns the {@link SavedSearch} with the given primary key
+ *
+ * @param subject the logged in user requesting the {@link SavedSearch} to be loaded
+ * @param savedSearchId the primary key of the {@link SavedSearch} to be loaded
+ *
+ * @return the {@link SavedSearch} or <code>null</code> if it wasn't found
+ * @throws PermissionException if the user is not authorized to view the {@link SavedSearch}. Regular users can
+ * only view {@link SavedSearch}es from their own accounts.
+ */
+ @WebMethod
+ public SavedSearch getSavedSearchById( //
+ @WebParam(name = "subject") Subject subject, //
+ @WebParam(name = "savedSearchId") int savedSearchId);
+}
commit c95388946134a47b002f5821c3a168db6f549355
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 22 21:06:31 2010 -0500
saved search hibernate entities
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java
new file mode 100644
index 0000000..9142772
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SavedSearch.java
@@ -0,0 +1,253 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.search;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.rhq.core.domain.auth.Subject;
+
+/**
+ * The data model for saved searches. Each users has his or her own set of
+ * saved searches, but inventory managers are allowed to "promote" their
+ * saved searches to GLOBAL status, which makes them available to all users
+ * under that installation of RHQ.
+ *
+ * There are two levels of pre-computed data within this structured. After
+ * the {@link SavedSearch} is created, the pattern will be translated into its
+ * JPQL equivalent and stored. If the {@link SavedSearch} is ever modified
+ * and saved, the JPQL will be re-computed.
+ *
+ * Periodically, the count-query version of the {@link SavedSearch} will be
+ * executed (using the stored JPQL), and the number of matching records will
+ * be stored. If this {@link SavedSearch} ever needs to be displayed on the
+ * user interface, it will by default retrieve this cached result count.
+ *
+ * @author Joseph Marques
+ */
+@Entity
+@SequenceGenerator(name = "id", sequenceName = "RHQ_SAVED_SEARCH_ID_SEQ")
+@Table(name = "RHQ_SAVED_SEARCH")
+public class SavedSearch {
+
+ @Id
+ @Column(name = "ID", nullable = false)
+ @GeneratedValue(strategy = GenerationType.AUTO, generator = "id")
+ private Integer id;
+
+ @Column(name = "CONTEXT", nullable = false)
+ @Enumerated(EnumType.STRING)
+ private SearchContext context;
+
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "PATTERN", nullable = false)
+ private String pattern;
+
+ @Column(name = "JPQL_TRANSLATION")
+ private String jpqlTranslation;
+
+ @Column(name = "LAST_COMPUTE_TIME", nullable = false)
+ private long lastComputeTime;
+
+ @Column(name = "RESULT_COUNT")
+ private Long resultCount;
+
+ @Column(name = "SUBJECT_ID", nullable = false)
+ private Subject subject;
+
+ @Column(name = "RESOURCE_ID", insertable = false, updatable = false)
+ private int subjectId;
+
+ @Column(name = "GLOBAL", nullable = false)
+ private boolean global;
+
+ protected SavedSearch() {
+ // no-arg ctor for Hibernate
+ }
+
+ public SavedSearch(SearchContext context, String name, String pattern, Subject subject) {
+ // call setters to go through parameter validation
+ setContext(context);
+ setPattern(pattern);
+ setSubject(subject);
+ setName(name); // name can be null, to allow for saving searches quickly
+
+ this.description = null;
+ this.jpqlTranslation = null; // null value for pre-computed JPQL implies computation is needed
+ this.lastComputeTime = 0; // further imply that computation needs to occur
+ this.resultCount = null; // NULL resultCount implies either computation failed or hasn't begun yet
+ this.global = false; // user must promote saved search to be a global after creation
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public SearchContext getContext() {
+ return context;
+ }
+
+ private void setContext(SearchContext context) {
+ if (context == null) {
+ throw new IllegalArgumentException("All saved searches must be bound to a SearchContext");
+ }
+ this.context = context;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ private void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ if (pattern == null || pattern.trim().equals("")) {
+ throw new IllegalArgumentException("All saved searches must have a non-empty pattern");
+ }
+ this.pattern = pattern;
+ }
+
+ public String getJpqlTranslation() {
+ return jpqlTranslation;
+ }
+
+ public void setJpqlTransation(String jpqlTranslation) {
+ this.jpqlTranslation = jpqlTranslation;
+ }
+
+ public long getLastComputeTime() {
+ return lastComputeTime;
+ }
+
+ public void setLastComputeTime(long lastComputeTime) {
+ this.lastComputeTime = lastComputeTime;
+ }
+
+ public Long getResultCount() {
+ return resultCount;
+ }
+
+ public void setResultCount(Long resultCount) {
+ this.resultCount = resultCount;
+ }
+
+ public Subject getSubject() {
+ return subject;
+ }
+
+ private void setSubject(Subject subject) {
+ if (subject == null) {
+ throw new IllegalArgumentException("All saved searches must be owned by a specific user");
+ }
+ this.subject = subject;
+ this.subjectId = subject.getId();
+ }
+
+ public int getSubjectId() {
+ return subjectId;
+ }
+
+ public boolean isGlobal() {
+ return global;
+ }
+
+ public void setGlobal(boolean global) {
+ this.global = global;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result) + subjectId;
+ result = (prime * result) + context.hashCode();
+ result = (prime * result) + ((name == null) ? 0 : name.hashCode());
+ result = (prime * result) + pattern.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if ((obj == null) || (!(obj instanceof SavedSearch))) {
+ return false;
+ }
+
+ final SavedSearch other = (SavedSearch) obj;
+
+ if (subjectId != other.subjectId) {
+ return false;
+ }
+
+ if (context != other.context) {
+ return false;
+ }
+
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+
+ if (!pattern.equals(other.pattern)) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/search/SearchContext.java b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SearchContext.java
new file mode 100644
index 0000000..bb045d5
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/search/SearchContext.java
@@ -0,0 +1,38 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.domain.search;
+
+/**
+ * The search mechanism is generic and, thus, suited to finding data in any
+ * RHQ subsystem, including its own. Each individual page in the UI can have
+ * different advanced syntax. This enum will serve as a unique identifier
+ * for which context is currently active. You can think of it as a piece of
+ * meta-data that annotates each saved search, representing which context it
+ * belongs to. This will also affect which grammar is used to auto-complete
+ * search expressions.
+ *
+ * @author Joseph Marques
+ */
+public enum SearchContext {
+ Resource, Group;
+}
commit c9d080cc510d6e4bf5c26c34f7b9050544736da3
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 22 21:06:19 2010 -0500
saved search dbupgrade scripts
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 1d4d3dd..2fb6a90 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.79</db.schema.version>
+ <db.schema.version>2.82</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 9af6aa5..834e9ce 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3202,6 +3202,31 @@
</statement>
</schema-directSQL>
</schemaSpec>
+
+ <schemaSpec version="2.82">
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_SAVED_SEARCH">
+ CREATE TABLE RHQ_SAVED_SEARCH ( ID INTEGER )
+ </statement>
+ </schema-directSQL>
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" columnType="VARCHAR2" precision="25" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="CONTEXT" nullable="FALSE" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="NAME" columnType="VARCHAR2" precision="200" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="DESCRIPTION" columnType="VARCHAR2" precision="500" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="PATTERN" columnType="VARCHAR2" precision="1000" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="PATTERN" nullable="FALSE" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="JPQL_TRANSLATION" columnType="VARCHAR2" precision="4000" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="LAST_COMPUTE_TIME" columnType="LONG" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="LAST_COMPUTE_TIME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="RESULT_COUNT" columnType="LONG" />
+
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="SUBJECT_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="SUBJECT_ID" nullable="FALSE" />
+ <schema-addColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" columnType="BOOLEAN" />
+ <schema-alterColumn table="RHQ_SAVED_SEARCH" column="GLOBAL" nullable="FALSE" />
+ </schemaSpec>
</dbupgrade>
</target>
</project>
commit afc78a9b2bfcb14b5b079ffb29aa82c4e6b0e81f
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 22 21:06:07 2010 -0500
saved searches dbsetup scripts
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
index 047d615..f5e4eae 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup-build.xml
@@ -39,7 +39,7 @@ To run the default target, you must set one of the following properties to true:
<property name="dbsetup.scripts.dir" value="${basedir}/src/main/scripts/dbsetup" />
<property name="dbsetup.output.dir" value="${basedir}/target/dbsetup" /> <!-- away from classes so it doesn't go into the jar -->
<!-- define the setup creation processing order. note, removals are done in the reverse order -->
- <property name="dbsetup.subsystems" value="config,cluster,inventory,auth,authz,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
+ <property name="dbsetup.subsystems" value="search,config,cluster,inventory,auth,authz,operation,event,alert,sysconfig,scheduler,amps,measurement,content,resource-request,jms,obsolete"/>
<property name="dbsetup.combined.schema" value="${dbsetup.output.dir}/all-schema.xml" />
<property name="dbsetup.combined.data" value="${dbsetup.output.dir}/all-data.xml" />
<property name="dbsetup.tstamp.file" value="${dbsetup.output.dir}/dbsetup-combine.tstamp" />
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml
new file mode 100644
index 0000000..7c0de23
--- /dev/null
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/search-schema.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dbsetup name="amps-schema.xml"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-dbsetup-schema">
+
+ <table name="RHQ_SAVED_SEARCH">
+ <column name="ID" default="sequence-only" initial="10001" primarykey="true" required="true" type="INTEGER"/>
+ <column name="CONTEXT" type="VARCHAR2" size="25" required="true"/>
+
+ <column name="NAME" type="VARCHAR2" size="200" required="true"/>
+ <column name="DESCRIPTION" type="VARCHAR2" size="500" required="false"/>
+ <column name="PATTERN" type="VARCHAR2" size="1000" required="true"/>
+
+ <column name="JPQL_TRANSLATION" type="VARCHAR2" size="4000" required="false"/>
+ <column name="LAST_COMPUTE_TIME" type="LONG" required="true"/>
+ <column name="RESULT_COUNT" type="LONG" required="false"/>
+
+ <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT" required="true"/>
+ <column name="ENABLED" type="BOOLEAN" required="true"/>
+ </table>
+
+</dbsetup>
\ No newline at end of file
commit e60d5bc39ad9c103e072eaa1e8fca7a0aedb9191
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Feb 22 21:35:49 2010 +0100
If no emails failed, we can set the state to success
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index ff4025f..c21bf21 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -739,6 +739,16 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
if (anl.getResultState()==ResultState.FAILED_EMAIL)
anl.setBadEmails(StringUtils.getListAsString(badList,","));
+ if (anl.getResultState()==ResultState.DEFERRED_EMAIL && badList.isEmpty())
+ anl.setResultState(ResultState.SUCCESS);
+ }
+ }
+ else { // No bad addresses
+ // Only set the result state to success for email sending notifications
+ // We must not set them if the notification failed.
+ for (AlertNotificationLog anl : alert.getAlertNotificationLogs()) {
+ if (anl.getResultState()==ResultState.DEFERRED_EMAIL)
+ anl.setResultState(ResultState.SUCCESS);
}
}
commit 6d87241b69c095bd2928f4e3b03bc9dcfbeeefd1
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sat Feb 20 10:49:01 2010 +0100
Fix potential NPE
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 5ed6d4f..b90def3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -113,8 +113,8 @@ public class AlertNotificationLog implements Serializable {
@PrePersist
@PreUpdate
public void trimMessage() {
- if (message.length()>255)
- message = message.substring(0,254);
+ if (message!=null && message.length()>255)
+ message = message.substring(0,255);
}
protected AlertNotificationLog() {
commit 2d38d85bb4500c1a873aba7b193fb9984d00539d
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sat Feb 20 09:47:10 2010 +0100
Truncate the message at 140 chars, as identi.ca bails out on longer messages; seems to improve stability with Twitter too.
Introduce abbreviated versions of the messages as space on Microblog etc is scarce. BZ 555091
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index ba75940..5ed6d4f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -38,6 +38,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -108,6 +110,13 @@ public class AlertNotificationLog implements Serializable {
@Transient
transient List<String> transientEmails = new ArrayList<String>();
+ @PrePersist
+ @PreUpdate
+ public void trimMessage() {
+ if (message.length()>255)
+ message = message.substring(0,254);
+ }
+
protected AlertNotificationLog() {
} // JPA
@@ -130,7 +139,6 @@ public class AlertNotificationLog implements Serializable {
public AlertNotificationLog(Alert alert, String senderName, ResultState state, String message) {
this.alert = alert;
- this.sender = sender;
this.resultState = state;
this.message = message;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 454b9a9..ff4025f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -780,7 +780,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
Map<String, String> alertMessage = emailManager.getAlertEmailMessage(
prettyPrintResourceHierarchy(alertDefinition.getResource()), alertDefinition.getResource().getName(),
alertDefinition.getName(), alertDefinition.getPriority().toString(), new Date(alert.getCtime()).toString(),
- prettyPrintAlertConditions(alert.getConditionLogs()), prettyPrintAlertURL(alert));
+ prettyPrintAlertConditions(alert.getConditionLogs(), false), prettyPrintAlertURL(alert));
String messageSubject = alertMessage.keySet().iterator().next();
String messageBody = alertMessage.values().iterator().next();
@@ -834,13 +834,14 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
/**
* Create a human readable description of the conditions that led to this alert.
* @param alert Alert to create human readable condition description
+ * @param shortVersion if true the messages printed are abbreviated to save space
* @return human readable condition log
*/
- public String prettyPrintAlertConditions(Alert alert) {
- return prettyPrintAlertConditions(alert.getConditionLogs());
+ public String prettyPrintAlertConditions(Alert alert, boolean shortVersion) {
+ return prettyPrintAlertConditions(alert.getConditionLogs(), shortVersion);
}
- private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs) {
+ private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs, boolean shortVersion) {
StringBuilder builder = new StringBuilder();
int conditionCounter = 1;
@@ -858,16 +859,27 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
builder.append(NEW_LINE);
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT,
- conditionCounter, prettyPrintAlertCondition(aLog.getCondition()), new SimpleDateFormat(
- "yyyy/MM/dd HH:mm:ss z").format(new Date(aLog.getCtime())), formattedValue));
+ String format;
+ if (shortVersion)
+ format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT;
+ else
+ format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT;
+ SimpleDateFormat dateFormat;
+ if (shortVersion)
+ dateFormat= new SimpleDateFormat(
+ "yy/MM/dd HH:mm:ss z");
+ else
+ dateFormat= new SimpleDateFormat(
+ "yyyy/MM/dd HH:mm:ss z");
+ builder.append(AlertI18NFactory.getMessage(format,
+ conditionCounter, prettyPrintAlertCondition(aLog.getCondition(), shortVersion), dateFormat.format(new Date(aLog.getCtime())), formattedValue));
conditionCounter++;
}
return builder.toString();
}
- private String prettyPrintAlertCondition(AlertCondition condition) {
+ private String prettyPrintAlertCondition(AlertCondition condition, boolean shortVersion) {
StringBuilder builder = new StringBuilder();
AlertConditionCategory category = condition.getCategory();
@@ -915,19 +927,38 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
} else if ((category == AlertConditionCategory.RESOURCE_CONFIG) || (category == AlertConditionCategory.CHANGE)
|| (category == AlertConditionCategory.TRAIT)) {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED));
+
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED));
+
} else if (category == AlertConditionCategory.EVENT) {
if ((condition.getOption() != null) && (condition.getOption().length() > 0)) {
+ String propsCbEventSeverityRegexMatch;
+ if (shortVersion)
+ propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT;
+ else
+ propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH;
+
builder.append(AlertI18NFactory.getMessage(
- AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH, condition.getName(),
+ propsCbEventSeverityRegexMatch, condition.getName(),
condition.getOption()));
} else {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY,
- condition.getName()));
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT,
+ condition.getName()));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY,
+ condition.getName()));
}
} else if (category == AlertConditionCategory.AVAILABILITY) {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY,
- condition.getOption()));
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT,
+ condition.getOption()));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY,
+ condition.getOption()));
} else {
// do nothing
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
index 996f245..e482ffa 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
@@ -96,9 +96,10 @@ public interface AlertManagerLocal {
/**
* Create a human readable description of the conditions that led to this alert.
* @param alert Alert to create human readable condition description
+ * @param shortVersion if true the messages printed are abbreviated to save space
* @return human readable condition log
*/
- String prettyPrintAlertConditions(Alert alert);
+ String prettyPrintAlertConditions(Alert alert, boolean shortVersion);
/**
* Tells us if the definition of the passed alert will be disabled after this alert was fired
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
index 8734771..1de3d85 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
@@ -32,20 +32,41 @@ public interface AlertI18NResourceKeys {
@I18NMessage(locale = "de", value = "Verfgbarkeit wird {0}") })
String ALERT_CONFIG_PROPS_CB_AVAILABILITY = "alert.config.props.CB.Availability";
+ @I18NMessages( { @I18NMessage("Avail goes {0}"),
+ @I18NMessage(locale = "de", value = "Verf. wird {0}") })
+ String ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT = "alert.config.props.CB.Availability.short";
+
@I18NMessages( { @I18NMessage("Event Severity: {0}"),
@I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0}") })
String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY = "alert.config.props.CB.EventSeverity";
+ @I18NMessages( { @I18NMessage("Sev: {0}"),
+ @I18NMessage(locale = "de", value = "Schwere: {0}") })
+ String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT = "alert.config.props.CB.EventSeverity.short";
+
@I18NMessages( { @I18NMessage("Event Severity: {0} and matching expression \"{1}\""),
@I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0} und zugehriger Ausdruck \"{1}\"") })
String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH = "alert.config.props.CB.EventSeverity.RegexMatch";
+ @I18NMessages( { @I18NMessage("Sev: {0} & exp \"{1}\""),
+ @I18NMessage(locale = "de", value = "Schwere: {0} & Ausdruck \"{1}\"") })
+ String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT = "alert.config.props.CB.EventSeverity.RegexMatch.short";
+
@I18NMessages( { @I18NMessage("value changed"), @I18NMessage(locale = "de", value = "Der Wert hat sich gendert") })
String ALERT_CURRENT_LIST_VALUE_CHANGED = "alert.current.list.ValueChanged";
+ @I18NMessages( { @I18NMessage("val chg"), @I18NMessage(locale = "de", value = "Wertnd.") })
+ String ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT = "alert.current.list.ValueChanged.short";
+
@I18NMessages( {
@I18NMessage("\\ - Condition {0}: {1}\\n\\\n" + "\\ - Date/Time: {2}\\n\\\n" + "\\ - Details: {3}\\n\\\n"),
@I18NMessage(locale = "de", value = " - Bedingung {0}: {1}\\n\\\n - Datum/Uhrzeit: {2}\\n\\\n"
+ "\\ - Details: {3}\\n\\\n") })
String ALERT_EMAIL_CONDITION_LOG_FORMAT = "alert.email.condition.log.format";
+
+ @I18NMessages( {
+ @I18NMessage("\\ - Cond {0}: {1}\\n\\\n" + "\\ - Time: {2}\\n\\\n" + "\\ - Det: {3}\\n\\\n"),
+ @I18NMessage(locale = "de", value = " - Bed {0}: {1}\\n\\\n - Zeit: {2}\\n\\\n"
+ + "\\ - Det: {3}\\n\\\n") })
+ String ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT = "alert.email.condition.log.format.short";
}
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
index 93eecc6..95abdb9 100644
--- a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
+++ b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
@@ -65,7 +65,7 @@ public class IrcSender extends AlertSender<IrcAlertComponent> {
b.append("): ");
b.append(alertManager.prettyPrintAlertURL(alert));
b.append("\n");
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, false));
return b.toString();
}
diff --git a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
index 257b315..b13763e 100644
--- a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
+++ b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
@@ -57,14 +57,19 @@ public class MicroblogSender extends AlertSender {
b.append("' (");
b.append(alert.getAlertDefinition().getResource().getId());
b.append("): ");
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, true));
b.append("-by @JBossJopr"); // TODO not for production :-)
// TODO use some alert url shortening service
SenderResult result ;
String txt = "user@baseUrl [" + user + "@" + baseUrl + "]:";
try {
- Status status = twitter.updateStatus(b.toString());
+ String msg = b.toString();
+ if (msg.length()>140)
+ msg = msg.substring(0,140);
+
+ Status status = twitter.updateStatus(msg);
+
result = new SenderResult(ResultState.SUCCESS,"Send notification to " + txt + ", msg-id: " + status.getId());
} catch (TwitterException e) {
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
index 649d6ed..b14c85d 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
@@ -74,7 +74,7 @@ public class MobicentsSender extends AlertSender {
// Switch locale to english, as the voice synthesizer expects this for now
Locale currentLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, false));
Locale.setDefault(currentLocale);
boolean willBeDisabled = alertManager.willDefinitionBeDisabled(alert);
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
index 985d890..bac51fb 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
+++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
@@ -93,7 +93,7 @@ public class ScriptLangSender extends AlertSender<ScriptLangComponent> {
Object[] args = new Object[3];
args[0] = alert;
args[1] = alertManager.prettyPrintAlertURL(alert);
- args[2] = alertManager.prettyPrintAlertConditions(alert);
+ args[2] = alertManager.prettyPrintAlertConditions(alert, false);
result = ((Invocable) engine).invokeFunction("sendAlert", args);
if (result == null) {
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
index 3fd5d79..045c3bb 100644
--- a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
+++ b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
@@ -68,7 +68,7 @@ public class SnmpSender extends AlertSender {
String result;
List<Resource> lineage = resourceManager.getResourceLineage(alert.getAlertDefinition().getResource().getId());
String platformName = lineage.get(0).getName();
- String conditions = alertManager.prettyPrintAlertConditions(alert);
+ String conditions = alertManager.prettyPrintAlertConditions(alert, false);
String alertUrl = alertManager.prettyPrintAlertURL(alert);
SenderResult res ;
commit 798ac30ead634c43a72beed52446a38d9bfc1f09
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:51:53 2010 -0500
i think this should report an error always on lock acq failure. we'll leave the flag alone - don't set it to true - let the next call take care of whether or not the init callback should be invoked or not
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 8c37b50..cd3b479 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -588,11 +588,9 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
writeLock.unlock();
}
} else {
- if (m_needToCallInitializeCallback) {
- Throwable t = new Throwable("Initialize callback lock could not be acquired");
- LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
- return new GenericCommandResponse(command, false, null, t);
- }
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
}
}
return null;
commit 9746ea32492b638eacb741d608d9ce17349c925d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:44:11 2010 -0500
should not worry about the lock failure if the init callback doesn't need to be invoked anyway
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 762b9b4..8c37b50 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -588,10 +588,11 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
writeLock.unlock();
}
} else {
- m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later
- Throwable t = new Throwable("Initialize callback lock could not be acquired");
- LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
- return new GenericCommandResponse(command, false, null, t);
+ if (m_needToCallInitializeCallback) {
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
+ }
}
}
return null;
commit c2cca917c88986ca48c84bbbdaf3408753299bf1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:38:16 2010 -0500
BZ 537396 - to not block indefinitely if a lock cannot be acquired before attempting to invoke the initialize callback
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 3775212..762b9b4 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -21,6 +21,9 @@ package org.rhq.enterprise.communications.command.client;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import mazz.i18n.Logger;
@@ -95,10 +98,22 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
private InitializeCallback m_initializeCallback;
/**
- * When the first element is <code>true</code>, the initialize callback will need to be called prior
- * to sending any commands. This is an array because the array itself is used for its lock.
+ * When <code>true</code>, the initialize callback will need to be called prior
+ * to sending any commands. Used in conjunection with its associated RW lock.
*/
- private final boolean[] m_needToCallInitializeCallback;
+ private boolean m_needToCallInitializeCallback;
+
+ /**
+ * RW lock when needing to access its associated atomic boolean flag.
+ */
+ private final ReentrantReadWriteLock m_needToCallInitializeCallbackLock;
+
+ /**
+ * Number of minutes to wait while attempting to aquire a lock before attempting
+ * to invoke the initialize callback. If this amount of minutes expires before the lock
+ * is acquired, an error will occur and the initialize callback will have to be attempted later.
+ */
+ private final long m_initializeCallbackLockAcquisitionTimeoutMins;
/**
* Constructor for {@link JBossRemotingRemoteCommunicator} that initializes the client with no invoker locator
@@ -200,7 +215,17 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
m_clientConfiguration.putAll(client_config);
}
- m_needToCallInitializeCallback = new boolean[] { false };
+ m_needToCallInitializeCallback = false;
+ m_needToCallInitializeCallbackLock = new ReentrantReadWriteLock();
+
+ long mins;
+ try {
+ String minsStr = System.getProperty("rhq.communications.initial-callback-lock-wait-mins", "60");
+ mins = Long.parseLong(minsStr);
+ } catch (Throwable t) {
+ mins = 60L;
+ }
+ m_initializeCallbackLockAcquisitionTimeoutMins = mins;
return;
}
@@ -319,7 +344,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
if (m_remotingClient != null) {
m_remotingClient.disconnect();
m_remotingClient = null;
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
LOG.info(CommI18NResourceKeys.COMMUNICATOR_CHANGING_ENDPOINT, m_invokerLocator, locator);
@@ -377,7 +402,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void setInitializeCallback(InitializeCallback callback) {
m_initializeCallback = callback;
- m_needToCallInitializeCallback[0] = (callback != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (callback != null); // specifically do not synchrononize by using lock, just set it
}
public String getRemoteEndpoint() {
@@ -403,7 +428,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void connect() throws Exception {
if ((m_remotingClient != null) && !m_remotingClient.isConnected()) {
m_remotingClient.connect();
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
return;
@@ -412,7 +437,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void disconnect() {
if (m_remotingClient != null) {
m_remotingClient.disconnect();
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
return;
@@ -535,18 +560,38 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
private CommandResponse invokeInitializeCallbackIfNeeded(Command command) {
InitializeCallback callback = getInitializeCallback();
if (callback != null) {
- // block here - in effect, this will stop all commands from going out until the callback is done
- synchronized (m_needToCallInitializeCallback) {
- if (m_needToCallInitializeCallback[0]) {
- try {
- m_needToCallInitializeCallback[0] = !callback.sendingInitialCommand(this, command);
- LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback[0]);
- } catch (Throwable t) {
- m_needToCallInitializeCallback[0] = true; // callback failed, we'll want to call it again
- LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil.getAllMessages(t));
- return new GenericCommandResponse(command, false, null, t);
+ // block here - in effect, this will stop all commands from going out until the callback is done
+ // to avoid infinite blocking, we'll only wait for a set time (though long).
+
+ WriteLock writeLock = m_needToCallInitializeCallbackLock.writeLock();
+ boolean locked;
+ try {
+ locked = writeLock.tryLock(m_initializeCallbackLockAcquisitionTimeoutMins, TimeUnit.MINUTES);
+ } catch (InterruptedException ie) {
+ locked = false;
+ }
+
+ if (locked) {
+ try {
+ if (m_needToCallInitializeCallback) {
+ try {
+ m_needToCallInitializeCallback = (!callback.sendingInitialCommand(this, command));
+ LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback);
+ } catch (Throwable t) {
+ m_needToCallInitializeCallback = true; // callback failed, we'll want to call it again
+ LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil
+ .getAllMessages(t));
+ return new GenericCommandResponse(command, false, null, t);
+ }
}
+ } finally {
+ writeLock.unlock();
}
+ } else {
+ m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
}
}
return null;
commit 55ba6f8778820bdd417e99909220136a2e1e091f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 11:10:53 2010 -0500
BZ 566724 - if classloader fails to be created, master PC will skip the plugin
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 f46eaf5..bd4feac 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
@@ -136,16 +136,23 @@ public class MasterServerPluginContainer {
String pluginName = descriptor.getName();
ServerPluginType pluginType = new ServerPluginType(descriptor);
PluginKey pluginKey = PluginKey.createServerPluginKey(pluginType.stringify(), pluginName);
- ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey);
- log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl
- + "] into its plugin container");
try {
- ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader, descriptor);
- boolean enabled = !allDisabledPlugins.contains(pluginKey);
- pc.loadPlugin(env, enabled);
- log.info("Preloaded server plugin [" + pluginKey.getPluginName() + "]");
+ ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey);
+ log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl
+ + "] into its plugin container");
+ try {
+ ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader,
+ descriptor);
+ boolean enabled = !allDisabledPlugins.contains(pluginKey);
+ pc.loadPlugin(env, enabled);
+ log.info("Preloaded server plugin [" + pluginName + "]");
+ } catch (Exception e) {
+ log.warn("Failed to preload server plugin [" + pluginName + "] from URL [" + pluginUrl
+ + "]", e);
+ }
} catch (Exception e) {
- log.warn("Failed to preload server plugin [" + pluginUrl + "]", e);
+ log.warn("Failed to preload server plugin [" + pluginName
+ + "]; cannot get its classloader from URL [ " + pluginUrl + "]", e);
}
} else {
log.warn("There is no server plugin container to support plugin: " + pluginUrl);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
index 9f27ce9..fa26970 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
@@ -64,7 +64,7 @@ public class ServerPluginClassLoader extends URLClassLoader {
try {
unpackedDirectory = unpackEmbeddedJars(pluginJarName, pluginUrl, classpathUrlList, tmpDirectory);
} catch (Exception e) {
- throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl);
+ throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl, e);
}
}
}
commit 2ffc564d7ff69a427755fa374419bc5980e47f94
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 19 13:37:36 2010 +0100
Fix link to definitions BZ 566004
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
index b6e386c..fd09f82 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
@@ -148,8 +148,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles"/>
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="id" value="#{Resource.id}"/>
<f:param name="ad" value="#{item.alert.alertDefinition.id}"/>
<h:outputText value="#{item.alert.alertDefinition.name}" />
commit a57abc5879531e4f58cc16f6fcd6655fdb035b77
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Feb 22 12:14:53 2010 +0100
Fix link from alert templates list to the view alert page. BZ 566896
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
index b7131e8..2f30a9c 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/listAlertTemplates.xhtml
@@ -28,7 +28,7 @@
</ui:define>
<ui:define name="body">
-
+
<br/>
<h:messages showSummary="true"
showDetail="true"
@@ -39,10 +39,10 @@
globalOnly="true"
layout="table"
width="100%"/>
-
+
<h:form id="alertTemplatesListForm">
<input type="hidden" name="type" value="${param.type}"/>
-
+
<rich:panel>
<f:facet name="header">
<h:outputText value="#{ResourceTypeUIBean.name} Alert Templates"/>
@@ -66,50 +66,49 @@
<f:facet name="PageControlView">
<onc:paginationControl id="AlertTemplatesList" />
</f:facet>
-
+
<rich:column>
<f:facet name="header">
<onc:allSelect target="selectedAlertTemplates" />
</f:facet>
-
+
<onc:select name="selectedAlertTemplates" value="#{item.id}" />
</rich:column>
-
+
<rich:column rendered="#{param.debug}">
<f:facet name="header">
<onc:sortableColumnHeader sort="a.id">
<h:outputText styleClass="headerText" value="ID" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.id}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.name">
<h:outputText styleClass="headerText" value="Name" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles"/>
+
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="type" value="#{param.type}"/>
<f:param name="ad" value="#{item.id}"/>
<h:outputText value="#{item.name}" />
</h:outputLink>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.description">
<h:outputText styleClass="headerText" value="Description" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.description}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.ctime">
@@ -121,14 +120,14 @@
<f:converter converterId="UserDateTimeConverter" />
</h:outputText>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.enabled">
<h:outputText styleClass="headerText" value="Active" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.enabled}"/>
</rich:column>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index dcfff68..a987e65 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -15,8 +15,18 @@
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+ <c:choose>
+ <c:when test="#{not empty param.type}">
+ <c:set var="title" value="Definition for '#{alertDefinition.name}' on resource type '#{ResourceTypeUIBean.name}'"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="title" value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'"/>
+ </c:otherwise>
+ </c:choose>
+
<ui:composition template="/rhq/layout/main.xhtml">
- <ui:param name="pageTitle" value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'"/>
+ <ui:param name="pageTitle" value="#{title}"/>
+
<ui:define name="metaHeaders">
<style>
@@ -49,11 +59,21 @@
<f:param name="ad" value="#{alertDefinition.id}" />
<h:outputText value=" Definition for '#{alertDefinition.name}' "/>
</h:outputLink>
- <h:outputText> on resource </h:outputText>
- <h:outputLink value="/rhq/resource/summary/overview.xhtml">
- <f:param name="id" value="#{alertDefinition.resource.id}" />
- <h:outputText value=" '#{alertDefinition.resource.name}'" />
- </h:outputLink>
+ <c:choose>
+ <c:when test="#{not empty param.type}">
+ <h:outputText> on resource type </h:outputText>
+ <h:outputLink value="/rhq/admin/listAlertTemplates.xhtml?type=${param.type}">
+ <h:outputText value=" #{ResourceTypeUIBean.name}"/>
+ </h:outputLink>
+ </c:when>
+ <c:otherwise>
+ <h:outputText> on resource </h:outputText>
+ <h:outputLink value="/rhq/resource/summary/overview.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}" />
+ <h:outputText value=" '#{alertDefinition.resource.name}'" />
+ </h:outputLink>
+ </c:otherwise>
+ </c:choose>
</ui:define>
<ui:define name="body">
@@ -170,10 +190,19 @@
<br />
<br />
- <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
- <f:param name="id" value="#{alertDefinition.resource.id}"/>
- <h:outputText value="Back to Alert Definitions for Resource '#{alertDefinition.resource.name}'"/>
- </h:outputLink>
+ <c:choose>
+ <c:when test="#{not empty param.type}">
+ <h:outputLink value="/rhq/admin/listAlertTemplates.xhtml?type=${param.type}">
+ <h:outputText value="Back to Alert Definitions for Resource Type '#{ResourceTypeUIBean.name}'"/>
+ </h:outputLink>
+ </c:when>
+ <c:otherwise>
+ <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}"/>
+ <h:outputText value="Back to Alert Definitions for Resource '#{alertDefinition.resource.name}'"/>
+ </h:outputLink>
+ </c:otherwise>
+ </c:choose>
<rich:modalPanel id="addAlertFromTemplatePanel" moveable="false" autosized="true">
<f:facet name="header">
@@ -230,4 +259,4 @@
</ui:define>
</ui:composition>
-</html>
\ No newline at end of file
+</html>
commit 3602414a6baff7fb52d637d2006574610212b46f
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sat Feb 20 10:49:01 2010 +0100
Fix potential NPE
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 5ed6d4f..b90def3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -113,8 +113,8 @@ public class AlertNotificationLog implements Serializable {
@PrePersist
@PreUpdate
public void trimMessage() {
- if (message.length()>255)
- message = message.substring(0,254);
+ if (message!=null && message.length()>255)
+ message = message.substring(0,255);
}
protected AlertNotificationLog() {
commit 1c26e0f7c827ae7a250b4de583d6ce623ca3ff50
Merge: 32b3daf... e1c7603...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sat Feb 20 09:52:53 2010 +0100
Merge branch 'master' into alertPlugin
commit 32b3daf0e818830cabf9797197666b8059472ba5
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sat Feb 20 09:47:10 2010 +0100
Truncate the message at 140 chars, as identi.ca bails out on longer messages; seems to improve stability with Twitter too.
Introduce abbreviated versions of the messages as space on Microblog etc is scarce. BZ 555091
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index ba75940..5ed6d4f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -38,6 +38,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -108,6 +110,13 @@ public class AlertNotificationLog implements Serializable {
@Transient
transient List<String> transientEmails = new ArrayList<String>();
+ @PrePersist
+ @PreUpdate
+ public void trimMessage() {
+ if (message.length()>255)
+ message = message.substring(0,254);
+ }
+
protected AlertNotificationLog() {
} // JPA
@@ -130,7 +139,6 @@ public class AlertNotificationLog implements Serializable {
public AlertNotificationLog(Alert alert, String senderName, ResultState state, String message) {
this.alert = alert;
- this.sender = sender;
this.resultState = state;
this.message = message;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 454b9a9..ff4025f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -780,7 +780,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
Map<String, String> alertMessage = emailManager.getAlertEmailMessage(
prettyPrintResourceHierarchy(alertDefinition.getResource()), alertDefinition.getResource().getName(),
alertDefinition.getName(), alertDefinition.getPriority().toString(), new Date(alert.getCtime()).toString(),
- prettyPrintAlertConditions(alert.getConditionLogs()), prettyPrintAlertURL(alert));
+ prettyPrintAlertConditions(alert.getConditionLogs(), false), prettyPrintAlertURL(alert));
String messageSubject = alertMessage.keySet().iterator().next();
String messageBody = alertMessage.values().iterator().next();
@@ -834,13 +834,14 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
/**
* Create a human readable description of the conditions that led to this alert.
* @param alert Alert to create human readable condition description
+ * @param shortVersion if true the messages printed are abbreviated to save space
* @return human readable condition log
*/
- public String prettyPrintAlertConditions(Alert alert) {
- return prettyPrintAlertConditions(alert.getConditionLogs());
+ public String prettyPrintAlertConditions(Alert alert, boolean shortVersion) {
+ return prettyPrintAlertConditions(alert.getConditionLogs(), shortVersion);
}
- private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs) {
+ private String prettyPrintAlertConditions(Set<AlertConditionLog> conditionLogs, boolean shortVersion) {
StringBuilder builder = new StringBuilder();
int conditionCounter = 1;
@@ -858,16 +859,27 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
builder.append(NEW_LINE);
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT,
- conditionCounter, prettyPrintAlertCondition(aLog.getCondition()), new SimpleDateFormat(
- "yyyy/MM/dd HH:mm:ss z").format(new Date(aLog.getCtime())), formattedValue));
+ String format;
+ if (shortVersion)
+ format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT;
+ else
+ format = AlertI18NResourceKeys.ALERT_EMAIL_CONDITION_LOG_FORMAT;
+ SimpleDateFormat dateFormat;
+ if (shortVersion)
+ dateFormat= new SimpleDateFormat(
+ "yy/MM/dd HH:mm:ss z");
+ else
+ dateFormat= new SimpleDateFormat(
+ "yyyy/MM/dd HH:mm:ss z");
+ builder.append(AlertI18NFactory.getMessage(format,
+ conditionCounter, prettyPrintAlertCondition(aLog.getCondition(), shortVersion), dateFormat.format(new Date(aLog.getCtime())), formattedValue));
conditionCounter++;
}
return builder.toString();
}
- private String prettyPrintAlertCondition(AlertCondition condition) {
+ private String prettyPrintAlertCondition(AlertCondition condition, boolean shortVersion) {
StringBuilder builder = new StringBuilder();
AlertConditionCategory category = condition.getCategory();
@@ -915,19 +927,38 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
} else if ((category == AlertConditionCategory.RESOURCE_CONFIG) || (category == AlertConditionCategory.CHANGE)
|| (category == AlertConditionCategory.TRAIT)) {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED));
+
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CURRENT_LIST_VALUE_CHANGED));
+
} else if (category == AlertConditionCategory.EVENT) {
if ((condition.getOption() != null) && (condition.getOption().length() > 0)) {
+ String propsCbEventSeverityRegexMatch;
+ if (shortVersion)
+ propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT;
+ else
+ propsCbEventSeverityRegexMatch = AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH;
+
builder.append(AlertI18NFactory.getMessage(
- AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH, condition.getName(),
+ propsCbEventSeverityRegexMatch, condition.getName(),
condition.getOption()));
} else {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY,
- condition.getName()));
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT,
+ condition.getName()));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY,
+ condition.getName()));
}
} else if (category == AlertConditionCategory.AVAILABILITY) {
- builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY,
- condition.getOption()));
+ if (shortVersion)
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT,
+ condition.getOption()));
+ else
+ builder.append(AlertI18NFactory.getMessage(AlertI18NResourceKeys.ALERT_CONFIG_PROPS_CB_AVAILABILITY,
+ condition.getOption()));
} else {
// do nothing
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
index 996f245..e482ffa 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
@@ -96,9 +96,10 @@ public interface AlertManagerLocal {
/**
* Create a human readable description of the conditions that led to this alert.
* @param alert Alert to create human readable condition description
+ * @param shortVersion if true the messages printed are abbreviated to save space
* @return human readable condition log
*/
- String prettyPrintAlertConditions(Alert alert);
+ String prettyPrintAlertConditions(Alert alert, boolean shortVersion);
/**
* Tells us if the definition of the passed alert will be disabled after this alert was fired
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
index 8734771..1de3d85 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/i18n/AlertI18NResourceKeys.java
@@ -32,20 +32,41 @@ public interface AlertI18NResourceKeys {
@I18NMessage(locale = "de", value = "Verfgbarkeit wird {0}") })
String ALERT_CONFIG_PROPS_CB_AVAILABILITY = "alert.config.props.CB.Availability";
+ @I18NMessages( { @I18NMessage("Avail goes {0}"),
+ @I18NMessage(locale = "de", value = "Verf. wird {0}") })
+ String ALERT_CONFIG_PROPS_CB_AVAILABILITY_SHORT = "alert.config.props.CB.Availability.short";
+
@I18NMessages( { @I18NMessage("Event Severity: {0}"),
@I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0}") })
String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY = "alert.config.props.CB.EventSeverity";
+ @I18NMessages( { @I18NMessage("Sev: {0}"),
+ @I18NMessage(locale = "de", value = "Schwere: {0}") })
+ String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_SHORT = "alert.config.props.CB.EventSeverity.short";
+
@I18NMessages( { @I18NMessage("Event Severity: {0} and matching expression \"{1}\""),
@I18NMessage(locale = "de", value = "Schwere des Ereignesses: {0} und zugehriger Ausdruck \"{1}\"") })
String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH = "alert.config.props.CB.EventSeverity.RegexMatch";
+ @I18NMessages( { @I18NMessage("Sev: {0} & exp \"{1}\""),
+ @I18NMessage(locale = "de", value = "Schwere: {0} & Ausdruck \"{1}\"") })
+ String ALERT_CONFIG_PROPS_CB_EVENT_SEVERITY_REGEX_MATCH_SHORT = "alert.config.props.CB.EventSeverity.RegexMatch.short";
+
@I18NMessages( { @I18NMessage("value changed"), @I18NMessage(locale = "de", value = "Der Wert hat sich gendert") })
String ALERT_CURRENT_LIST_VALUE_CHANGED = "alert.current.list.ValueChanged";
+ @I18NMessages( { @I18NMessage("val chg"), @I18NMessage(locale = "de", value = "Wertnd.") })
+ String ALERT_CURRENT_LIST_VALUE_CHANGED_SHORT = "alert.current.list.ValueChanged.short";
+
@I18NMessages( {
@I18NMessage("\\ - Condition {0}: {1}\\n\\\n" + "\\ - Date/Time: {2}\\n\\\n" + "\\ - Details: {3}\\n\\\n"),
@I18NMessage(locale = "de", value = " - Bedingung {0}: {1}\\n\\\n - Datum/Uhrzeit: {2}\\n\\\n"
+ "\\ - Details: {3}\\n\\\n") })
String ALERT_EMAIL_CONDITION_LOG_FORMAT = "alert.email.condition.log.format";
+
+ @I18NMessages( {
+ @I18NMessage("\\ - Cond {0}: {1}\\n\\\n" + "\\ - Time: {2}\\n\\\n" + "\\ - Det: {3}\\n\\\n"),
+ @I18NMessage(locale = "de", value = " - Bed {0}: {1}\\n\\\n - Zeit: {2}\\n\\\n"
+ + "\\ - Det: {3}\\n\\\n") })
+ String ALERT_EMAIL_CONDITION_LOG_FORMAT_SHORT = "alert.email.condition.log.format.short";
}
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
index 93eecc6..95abdb9 100644
--- a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
+++ b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
@@ -65,7 +65,7 @@ public class IrcSender extends AlertSender<IrcAlertComponent> {
b.append("): ");
b.append(alertManager.prettyPrintAlertURL(alert));
b.append("\n");
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, false));
return b.toString();
}
diff --git a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
index 257b315..b13763e 100644
--- a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
+++ b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
@@ -57,14 +57,19 @@ public class MicroblogSender extends AlertSender {
b.append("' (");
b.append(alert.getAlertDefinition().getResource().getId());
b.append("): ");
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, true));
b.append("-by @JBossJopr"); // TODO not for production :-)
// TODO use some alert url shortening service
SenderResult result ;
String txt = "user@baseUrl [" + user + "@" + baseUrl + "]:";
try {
- Status status = twitter.updateStatus(b.toString());
+ String msg = b.toString();
+ if (msg.length()>140)
+ msg = msg.substring(0,140);
+
+ Status status = twitter.updateStatus(msg);
+
result = new SenderResult(ResultState.SUCCESS,"Send notification to " + txt + ", msg-id: " + status.getId());
} catch (TwitterException e) {
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
index 649d6ed..b14c85d 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
@@ -74,7 +74,7 @@ public class MobicentsSender extends AlertSender {
// Switch locale to english, as the voice synthesizer expects this for now
Locale currentLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
- b.append(alertManager.prettyPrintAlertConditions(alert));
+ b.append(alertManager.prettyPrintAlertConditions(alert, false));
Locale.setDefault(currentLocale);
boolean willBeDisabled = alertManager.willDefinitionBeDisabled(alert);
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
index 985d890..bac51fb 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
+++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
@@ -93,7 +93,7 @@ public class ScriptLangSender extends AlertSender<ScriptLangComponent> {
Object[] args = new Object[3];
args[0] = alert;
args[1] = alertManager.prettyPrintAlertURL(alert);
- args[2] = alertManager.prettyPrintAlertConditions(alert);
+ args[2] = alertManager.prettyPrintAlertConditions(alert, false);
result = ((Invocable) engine).invokeFunction("sendAlert", args);
if (result == null) {
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
index 3fd5d79..045c3bb 100644
--- a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
+++ b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
@@ -68,7 +68,7 @@ public class SnmpSender extends AlertSender {
String result;
List<Resource> lineage = resourceManager.getResourceLineage(alert.getAlertDefinition().getResource().getId());
String platformName = lineage.get(0).getName();
- String conditions = alertManager.prettyPrintAlertConditions(alert);
+ String conditions = alertManager.prettyPrintAlertConditions(alert, false);
String alertUrl = alertManager.prettyPrintAlertURL(alert);
SenderResult res ;
commit e1c760378fe3f3fdcbee42beef05f9930eb3fd65
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:51:53 2010 -0500
i think this should report an error always on lock acq failure. we'll leave the flag alone - don't set it to true - let the next call take care of whether or not the init callback should be invoked or not
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 8c37b50..cd3b479 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -588,11 +588,9 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
writeLock.unlock();
}
} else {
- if (m_needToCallInitializeCallback) {
- Throwable t = new Throwable("Initialize callback lock could not be acquired");
- LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
- return new GenericCommandResponse(command, false, null, t);
- }
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
}
}
return null;
commit 1740b73d4ec9dddf1222fcf99b69a8164c090bbb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:44:11 2010 -0500
should not worry about the lock failure if the init callback doesn't need to be invoked anyway
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 762b9b4..8c37b50 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -588,10 +588,11 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
writeLock.unlock();
}
} else {
- m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later
- Throwable t = new Throwable("Initialize callback lock could not be acquired");
- LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
- return new GenericCommandResponse(command, false, null, t);
+ if (m_needToCallInitializeCallback) {
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
+ }
}
}
return null;
commit 60fa4314138911d607d6e95110987feb5a7b8fb7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 17:38:16 2010 -0500
BZ 537396 - to not block indefinitely if a lock cannot be acquired before attempting to invoke the initialize callback
diff --git a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
index 3775212..762b9b4 100644
--- a/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
+++ b/modules/enterprise/comm/src/main/java/org/rhq/enterprise/communications/command/client/JBossRemotingRemoteCommunicator.java
@@ -21,6 +21,9 @@ package org.rhq.enterprise.communications.command.client;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import mazz.i18n.Logger;
@@ -95,10 +98,22 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
private InitializeCallback m_initializeCallback;
/**
- * When the first element is <code>true</code>, the initialize callback will need to be called prior
- * to sending any commands. This is an array because the array itself is used for its lock.
+ * When <code>true</code>, the initialize callback will need to be called prior
+ * to sending any commands. Used in conjunection with its associated RW lock.
*/
- private final boolean[] m_needToCallInitializeCallback;
+ private boolean m_needToCallInitializeCallback;
+
+ /**
+ * RW lock when needing to access its associated atomic boolean flag.
+ */
+ private final ReentrantReadWriteLock m_needToCallInitializeCallbackLock;
+
+ /**
+ * Number of minutes to wait while attempting to aquire a lock before attempting
+ * to invoke the initialize callback. If this amount of minutes expires before the lock
+ * is acquired, an error will occur and the initialize callback will have to be attempted later.
+ */
+ private final long m_initializeCallbackLockAcquisitionTimeoutMins;
/**
* Constructor for {@link JBossRemotingRemoteCommunicator} that initializes the client with no invoker locator
@@ -200,7 +215,17 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
m_clientConfiguration.putAll(client_config);
}
- m_needToCallInitializeCallback = new boolean[] { false };
+ m_needToCallInitializeCallback = false;
+ m_needToCallInitializeCallbackLock = new ReentrantReadWriteLock();
+
+ long mins;
+ try {
+ String minsStr = System.getProperty("rhq.communications.initial-callback-lock-wait-mins", "60");
+ mins = Long.parseLong(minsStr);
+ } catch (Throwable t) {
+ mins = 60L;
+ }
+ m_initializeCallbackLockAcquisitionTimeoutMins = mins;
return;
}
@@ -319,7 +344,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
if (m_remotingClient != null) {
m_remotingClient.disconnect();
m_remotingClient = null;
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
LOG.info(CommI18NResourceKeys.COMMUNICATOR_CHANGING_ENDPOINT, m_invokerLocator, locator);
@@ -377,7 +402,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void setInitializeCallback(InitializeCallback callback) {
m_initializeCallback = callback;
- m_needToCallInitializeCallback[0] = (callback != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (callback != null); // specifically do not synchrononize by using lock, just set it
}
public String getRemoteEndpoint() {
@@ -403,7 +428,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void connect() throws Exception {
if ((m_remotingClient != null) && !m_remotingClient.isConnected()) {
m_remotingClient.connect();
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
return;
@@ -412,7 +437,7 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
public void disconnect() {
if (m_remotingClient != null) {
m_remotingClient.disconnect();
- m_needToCallInitializeCallback[0] = (getInitializeCallback() != null); // specifically do not synchronize, just set it
+ m_needToCallInitializeCallback = (getInitializeCallback() != null); // specifically do not synchrononize by using lock, just set it
}
return;
@@ -535,18 +560,38 @@ public class JBossRemotingRemoteCommunicator implements RemoteCommunicator {
private CommandResponse invokeInitializeCallbackIfNeeded(Command command) {
InitializeCallback callback = getInitializeCallback();
if (callback != null) {
- // block here - in effect, this will stop all commands from going out until the callback is done
- synchronized (m_needToCallInitializeCallback) {
- if (m_needToCallInitializeCallback[0]) {
- try {
- m_needToCallInitializeCallback[0] = !callback.sendingInitialCommand(this, command);
- LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback[0]);
- } catch (Throwable t) {
- m_needToCallInitializeCallback[0] = true; // callback failed, we'll want to call it again
- LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil.getAllMessages(t));
- return new GenericCommandResponse(command, false, null, t);
+ // block here - in effect, this will stop all commands from going out until the callback is done
+ // to avoid infinite blocking, we'll only wait for a set time (though long).
+
+ WriteLock writeLock = m_needToCallInitializeCallbackLock.writeLock();
+ boolean locked;
+ try {
+ locked = writeLock.tryLock(m_initializeCallbackLockAcquisitionTimeoutMins, TimeUnit.MINUTES);
+ } catch (InterruptedException ie) {
+ locked = false;
+ }
+
+ if (locked) {
+ try {
+ if (m_needToCallInitializeCallback) {
+ try {
+ m_needToCallInitializeCallback = (!callback.sendingInitialCommand(this, command));
+ LOG.debug(CommI18NResourceKeys.INITIALIZE_CALLBACK_DONE, m_needToCallInitializeCallback);
+ } catch (Throwable t) {
+ m_needToCallInitializeCallback = true; // callback failed, we'll want to call it again
+ LOG.error(t, CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, ThrowableUtil
+ .getAllMessages(t));
+ return new GenericCommandResponse(command, false, null, t);
+ }
}
+ } finally {
+ writeLock.unlock();
}
+ } else {
+ m_needToCallInitializeCallback = true; // can't invoke callback, we'll want to still call it later
+ Throwable t = new Throwable("Initialize callback lock could not be acquired");
+ LOG.error(CommI18NResourceKeys.INITIALIZE_CALLBACK_FAILED, t.getMessage());
+ return new GenericCommandResponse(command, false, null, t);
}
}
return null;
commit 474b186034125b179eb03e1ff069036a3299f730
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 19 11:10:53 2010 -0500
BZ 566724 - if classloader fails to be created, master PC will skip the plugin
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 f46eaf5..bd4feac 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
@@ -136,16 +136,23 @@ public class MasterServerPluginContainer {
String pluginName = descriptor.getName();
ServerPluginType pluginType = new ServerPluginType(descriptor);
PluginKey pluginKey = PluginKey.createServerPluginKey(pluginType.stringify(), pluginName);
- ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey);
- log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl
- + "] into its plugin container");
try {
- ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader, descriptor);
- boolean enabled = !allDisabledPlugins.contains(pluginKey);
- pc.loadPlugin(env, enabled);
- log.info("Preloaded server plugin [" + pluginKey.getPluginName() + "]");
+ ClassLoader classLoader = this.classLoaderManager.obtainServerPluginClassLoader(pluginKey);
+ log.debug("Pre-loading server plugin [" + pluginKey + "] from [" + pluginUrl
+ + "] into its plugin container");
+ try {
+ ServerPluginEnvironment env = new ServerPluginEnvironment(pluginUrl, classLoader,
+ descriptor);
+ boolean enabled = !allDisabledPlugins.contains(pluginKey);
+ pc.loadPlugin(env, enabled);
+ log.info("Preloaded server plugin [" + pluginName + "]");
+ } catch (Exception e) {
+ log.warn("Failed to preload server plugin [" + pluginName + "] from URL [" + pluginUrl
+ + "]", e);
+ }
} catch (Exception e) {
- log.warn("Failed to preload server plugin [" + pluginUrl + "]", e);
+ log.warn("Failed to preload server plugin [" + pluginName
+ + "]; cannot get its classloader from URL [ " + pluginUrl + "]", e);
}
} else {
log.warn("There is no server plugin container to support plugin: " + pluginUrl);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
index 9f27ce9..fa26970 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ServerPluginClassLoader.java
@@ -64,7 +64,7 @@ public class ServerPluginClassLoader extends URLClassLoader {
try {
unpackedDirectory = unpackEmbeddedJars(pluginJarName, pluginUrl, classpathUrlList, tmpDirectory);
} catch (Exception e) {
- throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl);
+ throw new Exception("Failed to unpack embedded JARs within: " + pluginUrl, e);
}
}
}
commit b5e46e4c6e802cdf883307c46e5a275a94514457
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 19 13:37:36 2010 +0100
Fix link to definitions BZ 566004
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
index b6e386c..fd09f82 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
@@ -148,8 +148,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles"/>
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="id" value="#{Resource.id}"/>
<f:param name="ad" value="#{item.alert.alertDefinition.id}"/>
<h:outputText value="#{item.alert.alertDefinition.name}" />
commit 195e7a1dd15ed80a86e8f6bcc1e2787d511de3a9
Author: Joseph Marques <joseph(a)redhat.com>
Date: Fri Feb 19 02:37:35 2010 -0500
BZ-534284 (RHQ-1095) - make hibernate.jsp work for non-string bind parameters:
* support binding to boolean as well as all numeric basic types;
* support binding to enums (user can enter ordinal or name [case-insensitively] of enum);
* support binding to entities (user can enter id / primary key);
* modify label for input field next to each query parameter to give a brief explanation of how it's supported;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java
index 282faec..5122c2f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/PersistenceUtility.java
@@ -22,6 +22,7 @@
*/
package org.rhq.core.domain.util;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -44,11 +45,16 @@ import org.hibernate.engine.NamedQueryDefinition;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.jmx.StatisticsService;
import org.hibernate.stat.Statistics;
+import org.hibernate.type.CustomType;
+import org.hibernate.type.EntityType;
+import org.hibernate.type.PrimitiveType;
+import org.hibernate.type.Type;
/**
* Various persistence utility methods - mostly Hibernate-specific.
*
* @author Heiko Rupp
+ * @author Joseph Marques
* @author Greg Hinkle
*/
public class PersistenceUtility {
@@ -61,6 +67,90 @@ public class PersistenceUtility {
public static final String HIBERNATE_STATISTICS_MBEAN_OBJECTNAME = "Hibernate:type=statistics,application=RHQ";
+ public static String getDisplayString(Type hibernateType) {
+ if (hibernateType instanceof EntityType) {
+ return hibernateType.getName() + " (enter integer of ID / primary key field)";
+ } else if (hibernateType instanceof CustomType) {
+ if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) {
+ Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass();
+ StringBuilder result = new StringBuilder();
+ result.append(enumClass.getName());
+ result.append(" (");
+ boolean first = true;
+ for (Enum<?> nextEnum : enumClass.getEnumConstants()) {
+ if (!first) {
+ result.append(" | ");
+ } else {
+ first = false;
+ }
+ result.append(nextEnum.name());
+ }
+ result.append(")");
+ return result.toString();
+ }
+ }
+ return hibernateType.getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Object cast(String value, Type hibernateType) {
+ if (hibernateType instanceof PrimitiveType) {
+ Class<?> type = ((PrimitiveType) hibernateType).getPrimitiveClass();
+ if (type.equals(Byte.TYPE)) {
+ return Byte.valueOf(value);
+ } else if (type.equals(Short.TYPE)) {
+ return Short.valueOf(value);
+ } else if (type.equals(Integer.TYPE)) {
+ return Integer.valueOf(value);
+ } else if (type.equals(Long.TYPE)) {
+ return Long.valueOf(value);
+ } else if (type.equals(Float.TYPE)) {
+ return Float.valueOf(value);
+ } else if (type.equals(Double.TYPE)) {
+ return Double.valueOf(value);
+ } else if (type.equals(Boolean.TYPE)) {
+ return Boolean.valueOf(value);
+ }
+ } else if (hibernateType instanceof EntityType) {
+ String entityName = ((EntityType) hibernateType).getAssociatedEntityName();
+ try {
+ Class<?> entityClass = Class.forName(entityName);
+ Object entity = entityClass.newInstance();
+
+ Field primaryKeyField = entityClass.getDeclaredField("id");
+ primaryKeyField.setAccessible(true);
+ primaryKeyField.setInt(entity, Integer.valueOf(value));
+ return entity;
+ } catch (Throwable t) {
+ throw new IllegalArgumentException("Type[" + entityName + "] must have PK field named 'id'");
+ }
+ } else if (hibernateType instanceof CustomType) {
+ if (Enum.class.isAssignableFrom(hibernateType.getReturnedClass())) {
+ Class<? extends Enum<?>> enumClass = hibernateType.getReturnedClass();
+ Enum<?>[] enumValues = enumClass.getEnumConstants();
+ try {
+ int enumOrdinal = Integer.valueOf(value);
+ try {
+ return enumValues[enumOrdinal];
+ } catch (ArrayIndexOutOfBoundsException aioobe) {
+ throw new IllegalArgumentException("There is no " + enumClass.getSimpleName()
+ + " enum with ordinal '" + enumOrdinal + "'");
+ }
+ } catch (NumberFormatException nfe) {
+ String ucaseValue = value.toUpperCase();
+ for (Enum<?> nextEnum : enumValues) {
+ if (nextEnum.name().toUpperCase().equals(ucaseValue)) {
+ return nextEnum;
+ }
+ }
+ throw new IllegalArgumentException("There is no " + enumClass.getSimpleName() + " enum with name '"
+ + value + "'");
+ }
+ }
+ }
+ return value;
+ }
+
/**
* Used to create queries to use with the {@link PageControl} objects. The query will already have its sort column
* and order appended as well as having its first result and max results set according to the page control data.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
index 95424b1..7dc7c2e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
@@ -7,6 +7,7 @@
<%@ page import="org.hibernate.type.IntegerType" %>
<%@ page import="org.hibernate.type.LongType" %>
<%@ page import="org.hibernate.type.Type" %>
+<%@ page import="org.rhq.core.domain.util.PersistenceUtility" %>
<%@ page import="org.rhq.enterprise.gui.legacy.util.SessionUtils" %>
<%@ page import="org.rhq.enterprise.server.util.LookupUtil" %>
<%@ page import="javax.naming.InitialContext" %>
@@ -143,7 +144,7 @@
<td><input type="text" name="${pn}" value="${param[pn]}"></td>
<td>
<c:set value="${pn}" var="pn" scope="request"/>
- <%=qt.getParameterTranslations().getNamedParameterExpectedType((String) request.getAttribute("pn")).getName()%>
+ <%=PersistenceUtility.getDisplayString(qt.getParameterTranslations().getNamedParameterExpectedType((String) request.getAttribute("pn")))%>
</td>
</tr>
</c:forEach>
@@ -163,15 +164,10 @@
Iterator iter = parameterNames.iterator();
while (iter.hasNext()) {
String pn = (String) iter.next();
- Object paramterValue = request.getParameter(pn);
+ Object paramValue = request.getParameter(pn);
Type type = qt.getParameterTranslations().getNamedParameterExpectedType(pn);
- if (type instanceof LongType)
- paramterValue = Long.parseLong((String) paramterValue);
- else if (type instanceof IntegerType)
- paramterValue = Integer.parseInt((String) paramterValue);
-
- //out.println("parameter " + pn + " = " + paramterValue);
- q.setParameter(pn, paramterValue);
+ paramValue = PersistenceUtility.cast((String)paramValue, type);
+ q.setParameter(pn, paramValue);
}
if (isDMLStyle) {
commit e2dce2b51a6948629af959d88011b86c122ed209
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 18 19:35:40 2010 -0500
update hibernate.jsp to provide translations for DML-style operations;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
index 0147f1e..95424b1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/admin/test/hibernate.jsp
@@ -106,7 +106,7 @@
<%
if (hql != null || namedQuery != null) {
System.out.println("hql: " + hql);
- String sql = null;
+ List<String> sqlStrings = null;
Set<String> parameterNames = null;
try {
qt = new ASTQueryTranslatorFactory().createQueryTranslator(
@@ -116,12 +116,10 @@
(SessionFactoryImplementor) s.getSessionFactory());
qt.compile(null, false);
- sql = qt.getSQLString();
+ sqlStrings = qt.collectSqlStrings();
- if (sql == null) {
- out.write("Could not get SQL translation for DML-style operation");
- } else {
- out.write("<b>SQL: </b><textarea rows=\"10\" cols=\"120\">" + sql + "</textarea>");
+ for (String nextSQL : sqlStrings) {
+ out.write("<b>SQL: </b><textarea rows=\"10\" cols=\"120\">" + nextSQL + "</textarea>");
}
ParameterTranslations pt = qt.getParameterTranslations();
commit 8f6ee4ef76b4b4158b28b48c117a7ce1b448dba1
Merge: 3c21fc0... 2622dd5...
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 18 19:28:47 2010 -0500
Merge branch 'master' into search
commit 2622dd5e50066c74d29e532d156ceabbe10a30f6
Author: Bryan Kearney <bkearney(a)redhat.com>
Date: Thu Feb 18 13:27:31 2010 -0500
553398: Fixed a typo
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml
index ae84d32..31e3a5a 100644
--- a/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/alert-snmp/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -36,7 +36,7 @@
<c:simple-property name="agentAddress" description="Address of our SNMP agent" required="false"/>
</c:group>
<!--
- <c:group name="2c" displayName="Snmp version 2c properties" hiddenByDefault="true">
+ <c:group name="2c" displayName="SNMP version 2c properties" hiddenByDefault="true">
Nothing special
</c:group>
-->
commit 2773498807e134fb00ecf913f3959a3c1d68fcf3
Merge: 4578f4b... f26a775...
Author: Partha Aji <paji(a)redhat.com>
Date: Thu Feb 18 11:05:58 2010 -0500
Fixed merge conflicts
diff --cc modules/enterprise/server/ear/pom.xml
index d802da0,180e1bf..191cf0a
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@@ -279,6 -283,55 +279,54 @@@
<artifactId>rhq-core-perspective</artifactId>
<version>${project.version}</version>
</artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq.server</groupId>
+ <artifactId>alert-email</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-irc</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-mobicents</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-microblog</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-roles</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-scriptlang</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-snmp</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-subject</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
-
</artifactItems>
<outputDirectory>${earDirectory}/rhq-serverplugins</outputDirectory>
</configuration>
commit f26a7759997eb9111dcfde1b0a9c51f99a8285b4
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Thu Feb 18 10:24:32 2010 -0500
Added alert plugins to release build process.
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 175420d..180e1bf 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -63,7 +63,7 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
-
+
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-content_http</artifactId>
@@ -141,7 +141,7 @@
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
- <displayName>RHQ</displayName>
+ <displayName>RHQ</displayName>
<workDirectory>${earDirectory}</workDirectory>
<resourcesDir>${basedir}/target/classes</resourcesDir>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
@@ -165,7 +165,7 @@
<bundleFileName>rhq-webdav.war</bundleFileName>
<contextRoot>/webdav</contextRoot>
</webModule>
-
+
<!-- used to expose content through http -->
<webModule>
<groupId>${project.groupId}</groupId>
@@ -284,6 +284,54 @@
<version>${project.version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.rhq.server</groupId>
+ <artifactId>alert-email</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-irc</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-mobicents</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-microblog</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-roles</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-scriptlang</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-snmp</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-subject</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
</artifactItems>
<outputDirectory>${earDirectory}/rhq-serverplugins</outputDirectory>
</configuration>
@@ -305,7 +353,7 @@
</activation>
<build>
- <plugins>
+ <plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@@ -393,7 +441,7 @@
</activation>
<build>
- <plugins>
+ <plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@@ -518,7 +566,7 @@
</activation>
<build>
- <plugins>
+ <plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
index 22aabed..45d61df 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
+++ b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
@@ -11,6 +11,7 @@
<groupId>org.rhq</groupId>
<artifactId>alert-scriptlang</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Script lang Alert Plugin</name>
@@ -147,4 +148,4 @@
</build>
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml
index 019db2f..31520b5 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -11,6 +11,7 @@
<groupId>org.rhq</groupId>
<artifactId>alert-subject</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Subject Alert Plugin</name>
@@ -130,4 +131,4 @@
</profiles>
-</project>
\ No newline at end of file
+</project>
commit 4578f4b209c533955a8d16c87194443577f5b481
Merge: 6c71908... 5c2960a...
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 18 16:21:16 2010 +0100
Merge branch 'master' into linux-config
Conflicts:
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
diff --cc modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
index 461b310,6c34c28..0ad0c7a
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
@@@ -36,13 -38,13 +38,13 @@@ import org.rhq.core.domain.resource.Res
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.core.gui.util.StringUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.converter.SelectItemUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
--import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+ import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --cc modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
index a632467,ad870c8..2cc9a52
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
@@@ -143,23 -149,20 +143,20 @@@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do" rendered="#{empty item.original.alertDefinition.resourceType and empty item.original.alertDefinition.resourceGroup}">
- <f:param name="mode" value="viewRoles" />
- <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{empty item.alertDefinition.resourceType and empty item.alertDefinition.resourceGroup}">
- <f:param name="id" value="#{item.alertDefinition.resource.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
++ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{empty item.original.alertDefinition.resourceType and empty item.original.alertDefinition.resourceGroup}">
+ <f:param name="id" value="#{item.original.alertDefinition.resource.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.resourceType}">
- <f:param name="mode" value="viewRoles" />
- <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.alertDefinition.resourceType}">
- <f:param name="type" value="#{item.alertDefinition.resourceType.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
++ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.original.alertDefinition.resourceType}">
+ <f:param name="type" value="#{item.original.alertDefinition.resourceType.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.resourceGroup}">
- <f:param name="mode" value="viewRoles" />
- <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.alertDefinition.resourceGroup}">
- <f:param name="groupId" value="#{item.alertDefinition.resourceGroup.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
++ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.original.alertDefinition.resourceGroup}">
+ <f:param name="groupId" value="#{item.original.alertDefinition.resourceGroup.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
</rich:column>
diff --cc modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
index 16b3667,2186950..bf591c4
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
@@@ -138,16 -144,15 +138,15 @@@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles" />
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
- <f:param name="id" value="#{item.alert.alertDefinition.resource.id}" />
- <f:param name="ad" value="#{item.alert.alertDefinition.id}" />
+ <f:param name="id" value="#{item.original.alert.alertDefinition.resource.id}" />
+ <f:param name="ad" value="#{item.original.alert.alertDefinition.id}" />
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'LOW'}" value="/images/icons/Flag_blue_16.png"/>
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'MEDIUM'}" value="/images/icons/Flag_yellow_16.png"/>
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'HIGH'}" value="/images/icons/Flag_red_16.png"/>
- <h:outputText value="#{item.alert.alertDefinition.name}" />
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'LOW'}" value="/images/icons/Flag_blue_16.png"/>
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'MEDIUM'}" value="/images/icons/Flag_yellow_16.png"/>
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'HIGH'}" value="/images/icons/Flag_red_16.png"/>
+ <h:outputText value="#{item.original.alert.alertDefinition.name}" />
</h:outputLink>
</rich:column>
@@@ -166,6 -171,25 +165,25 @@@
</rich:column>
<rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Ack by" />
+ </f:facet>
- <h:outputText value="#{item.alert.ackBy.name}" title="#{item.alert.ackBy.firstName} #{item.alert.ackBy.lastName}"/>
++ <h:outputText value="#{item.original.alert.ackBy.name}" title="#{item.original.alert.ackBy.firstName} #{item.original.alert.ackBy.lastName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="a.ackTime">
+ <h:outputText styleClass="headerText" value="Ack date" />
+ </onc:sortableColumnHeader>
+ </f:facet>
- <h:outputText value="#{item.alert.ackTime}">
++ <h:outputText value="#{item.original.alert.ackTime}">
+ <f:converter converterId="RelativeDurationConverter" />
+ </h:outputText>
+ </rich:column>
+
+
+ <rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Recovery Info" />
</f:facet>
commit 5c2960aa68fb3a157aa99cebf5f02f5138cafa9d
Author: Bryan Kearney <bkearney(a)redhat.com>
Date: Fri Feb 5 13:59:42 2010 -0500
Attempt to agressively free resources from the libivrt API in order to reduce interaction with SIGAR
diff --git a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/LibVirtConnection.java b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/LibVirtConnection.java
index fd54ef8..6b16328 100644
--- a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/LibVirtConnection.java
+++ b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/LibVirtConnection.java
@@ -120,6 +120,7 @@ public class LibVirtConnection {
info.domainInfo = domain.getInfo();
info.name = domainName;
info.uuid = domain.getUUIDString();
+ domain.free();
return info;
} catch (LibvirtException e) {
@@ -136,6 +137,7 @@ public class LibVirtConnection {
info.domainInfo = domain.getInfo();
info.name = domain.getName();
info.uuid = domain.getUUIDString();
+ domain.free();
return info;
} catch (LibvirtException e) {
@@ -146,12 +148,16 @@ public class LibVirtConnection {
public String getDomainXML(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
- return domain.getXMLDesc(0);
+ String returnValue = domain.getXMLDesc(0);
+ domain.free();
+
+ return returnValue;
}
public int domainReboot(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.reboot(0);
+ domain.free();
return SUCCESS;
}
@@ -162,79 +168,97 @@ public class LibVirtConnection {
public int domainDestroy(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
- domain.destroy() ;
+ domain.destroy();
+ domain.free();
return SUCCESS;
}
-
+
public int domainDelete(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
- DomainState state = domain.getInfo().state ;
-
+ DomainState state = domain.getInfo().state;
+
if ((state != DomainState.VIR_DOMAIN_SHUTDOWN) && (state != DomainState.VIR_DOMAIN_SHUTOFF)) {
- domain.destroy() ;
- }
- domain.undefine() ;
+ domain.destroy();
+ }
+ domain.undefine();
+ domain.free();
return SUCCESS;
- }
-
+ }
+
public int domainSave(String domainName, String toPath) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.save(toPath);
+ domain.free();
return SUCCESS;
- }
+ }
public int domainResume(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.resume();
+ domain.free();
return SUCCESS;
}
public int domainShutdown(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.shutdown();
+ domain.free();
return SUCCESS;
}
public int domainSuspend(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.suspend();
+ domain.free();
return SUCCESS;
}
public int domainCreate(String domainName) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.create();
+ domain.free();
return SUCCESS;
}
public boolean defineDomain(String xml) throws LibvirtException {
Domain dom = connection.domainDefineXML(xml);
- return dom != null;
+ boolean returnValue = (dom != null);
+ if (returnValue) {
+ dom.free();
+ }
+ return returnValue;
}
public void setMaxMemory(String domainName, long size) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.setMaxMemory(size);
+ domain.free();
}
public void setMemory(String domainName, long size) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.setMemory(size);
+ domain.free();
}
public void setVcpus(String domainName, int count) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
domain.setVcpus(count);
+ domain.free();
}
public DomainInterfaceStats getDomainInterfaceStats(String domainName, String path) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
- return domain.interfaceStats(path);
+ DomainInterfaceStats returnValue = domain.interfaceStats(path);
+ domain.free();
+ return returnValue;
}
public DomainBlockStats getDomainBlockStats(String domainName, String path) throws LibvirtException {
Domain domain = connection.domainLookupByName(domainName);
- return domain.blockStats(path);
+ DomainBlockStats returnValue = domain.blockStats(path);
+ domain.free();
+ return returnValue;
}
public int close() throws LibvirtException {
@@ -261,6 +285,7 @@ public class LibVirtConnection {
for (int id : connection.listDomains()) {
Domain domain = connection.domainLookupByID(id);
cpuTime += domain.getInfo().cpuTime;
+ domain.free();
}
return cpuTime;
}
@@ -296,19 +321,28 @@ public class LibVirtConnection {
return getNetworks().contains(name);
}
- public Network getNetwork(String name) throws LibvirtException {
- return connection.networkLookupByName(name);
+ //TODO NEED TO ADD A NETWORK OBJECT AND FREE THE LIBVIRT ONE
+ public NetworkInfo getNetwork(String name) throws LibvirtException {
+ NetworkInfo info = new NetworkInfo();
+ Network net = connection.networkLookupByName(name);
+ info.name = net.getName();
+ info.autostart = net.getAutostart();
+ info.bridgeName = net.getBridgeName();
+ return info;
}
public String getNetworkXML(String name) throws LibvirtException {
Network network = connection.networkLookupByName(name);
- return network.getXMLDesc(0);
+ String returnValue = network.getXMLDesc(0);
+ network.free();
+ return returnValue;
}
public void updateNetwork(String name, String xml, boolean autostart) throws LibvirtException {
connection.networkDefineXML(xml);
Network network = connection.networkLookupByName(name);
network.setAutostart(autostart);
+ network.free();
}
public static class DomainInfo {
@@ -318,6 +352,12 @@ public class LibVirtConnection {
public org.libvirt.DomainInfo domainInfo;
}
+ public static class NetworkInfo {
+ public String name;
+ public boolean autostart;
+ public String bridgeName;
+ }
+
public static class HVInfo {
public long libvirtVersion;
public String hvType;
@@ -346,6 +386,7 @@ public class LibVirtConnection {
}
}
}
+
//TODO Put the callbacks in
/* Comment this out untilt he callbacks get in*/
class Logger extends org.libvirt.ErrorCallback {
@@ -360,4 +401,4 @@ class Logger extends org.libvirt.ErrorCallback {
public void errorCallback(Pointer arg0, virError arg1) {
log.warn("Libvirt Error: " + arg1.message);
}
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkComponent.java b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkComponent.java
index 9517074..f59fc28 100644
--- a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkComponent.java
+++ b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkComponent.java
@@ -104,7 +104,7 @@ public class VirtualizationNetworkComponent implements ResourceComponent<Virtual
LibVirtConnection virt = getConnection();
String xml = virt.getNetworkXML(networkName);
- boolean autostart = virt.getNetwork(networkName).getAutostart();
+ boolean autostart = virt.getNetwork(networkName).autostart;
return XMLEditor.getNetworkConfiguration(xml, autostart);
}
diff --git a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkDiscoveryComponent.java b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkDiscoveryComponent.java
index 31c58bb..3b5816f 100644
--- a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkDiscoveryComponent.java
+++ b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationNetworkDiscoveryComponent.java
@@ -25,13 +25,13 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.libvirt.LibvirtException;
-import org.libvirt.Network;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.virt.LibVirtConnection.NetworkInfo;
/**
* @author Greg Hinkle
@@ -81,8 +81,8 @@ public class VirtualizationNetworkDiscoveryComponent implements ResourceDiscover
return details;
}
- public DiscoveredResourceDetails createResource(ResourceType resourceType, Network net) throws LibvirtException {
- String name = net.getName();
+ public DiscoveredResourceDetails createResource(ResourceType resourceType, NetworkInfo net) throws LibvirtException {
+ String name = net.name;
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(resourceType, name, name, null,
"Virtual Network Named " + name, null, null);
return detail;
commit 6c71908ac3a1ce03cba811cb1fc5d3a7281c03b5
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Feb 17 12:24:35 2010 -0500
fix some errors in the section that copies agent plugins, which appear to be a result of the recent merge from master
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 11f5ae2..d802da0 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -219,7 +219,7 @@
<executions>
<execution>
- <id>copy-core-plugins</id>
+ <id>copy-core-agent-plugins</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
@@ -228,124 +228,34 @@
<artifactItems>
<artifactItem>
<groupId>org.rhq</groupId>
- <artifactId>rhq-agent-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-aliases-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-apache-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-augeas-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-cobbler-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-cron-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-database-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-grub-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-hosts-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-hudson-plugin</artifactId>
+ <artifactId>rhq-platform-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
- <artifactId>rhq-iis-plugin</artifactId>
+ <artifactId>rhq-agent-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
- <!--
- TODO: Uncomment once errors from RHQ-1226 are fixed. <artifactItem>
- <groupId>org.rhq</groupId> <artifactId>rhq-jira-plugin</artifactId>
- <version>${project.version}</version> </artifactItem>
- -->
<artifactItem>
<groupId>org.rhq</groupId>
<artifactId>rhq-jmx-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-mysql-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-netservices-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-oracle-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-perftest-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-platform-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
</artifactItems>
<outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
</configuration>
</execution>
<execution>
- <id>copy-rhq-serverplugins</id>
+ <id>copy-core-server-plugins</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
-
<artifactItem>
<groupId>org.rhq</groupId>
<artifactId>rhq-serverplugin-disk</artifactId>
@@ -369,7 +279,6 @@
<artifactId>rhq-core-perspective</artifactId>
<version>${project.version}</version>
</artifactItem>
-
</artifactItems>
<outputDirectory>${earDirectory}/rhq-serverplugins</outputDirectory>
</configuration>
commit 2774093db82b1822e97fada86ffb74ba6fad23d5
Merge: b9d9242... 900d254...
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 17 11:24:03 2010 -0500
Merge branch 'raw-config'
commit b9d9242c291d96b52b91812a67dfc32123677d92
Merge: 1826981... 5f217ae...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Wed Feb 17 15:45:30 2010 +0100
Merge branch 'master' into alertPlugin
diff --cc modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index f7d4649,94da384..9af6aa5
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@@ -3015,31 -3014,169 +3015,193 @@@
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="snmp_oid"/>
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="email_address"/>
</schemaSpec>
+ <schemaSpec version="2.77.3">
+ <schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="role_id"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="subject_id"/>
+ </schemaSpec>
+ <schemaSpec version="2.77.4">
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="roles"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="subjects"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="emails"/>
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="SENDER" columnType="VARCHAR2" precision="200" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="RESULT_STATE" columnType="VARCHAR2" precision="20" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="255" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="ALL_EMAILS" columnType="VARCHAR2" precision="4096" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_FAILED" columnType="VARCHAR2" precision="4096" />
+ </schemaSpec>
+ <schemaSpec version="2.77.5">
+ <schema-directSQL>
+ <statement>
- DROP INDEX IF EXISTS RHQ_ALERT_IDX_ALERT
++ DROP INDEX IF EXISTS RHQ_ALERT_IDX_ALERT
+ </statement>
+ <statement>
+ CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG (alert_id)
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+ <schemaSpec version="2.78">
- <!-- Remove obsolete tables RHQ_BUNDLE_CONFIG and RHQ_BUNDLE_DEPLOYMENT (the latter by cascade) -->
++ <!-- Remove obsolete tables RHQ_BUNDLE_CONFIG and RHQ_BUNDLE_DEPLOYMENT (the latter by cascade) -->
+ <schema-dropTable table="RHQ_BUNDLE_DEPLOYMENT" />
+ <schema-dropTable table="RHQ_BUNDLE_CONFIG" />
+ <schema-dropSequence name="rhq_bundle_config_id_seq" />
-
++
+ <schema-addColumn table="RHQ_BUNDLE_VERSION" column="CONFIG_DEF_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_VERSION foreign key relation to RHQ_CONFIG_DEF">
+ ALTER TABLE RHQ_BUNDLE_VERSION
+ ADD CONSTRAINT RHQ_CONFIG_DEF_ID_FK
+ FOREIGN KEY (CONFIG_DEF_ID)
+ REFERENCES RHQ_CONFIG_DEF (ID)
+ </statement>
+ </schema-directSQL>
+
+ <schema-addColumn table="RHQ_BUNDLE_TYPE" column="RESOURCE_TYPE_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_TYPE foreign key relation to RHQ_RESOURCE_TYPE">
+ ALTER TABLE RHQ_BUNDLE_TYPE
+ ADD CONSTRAINT RHQ_RESOURCE_TYPE_ID_FK
+ FOREIGN KEY (RESOURCE_TYPE_ID)
+ REFERENCES RHQ_RESOURCE_TYPE (ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- RHQ_BUNDLE_DEPLOY_DEF -->
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_BUNDLE_DEPLOY_DEF">
+ CREATE TABLE RHQ_BUNDLE_DEPLOY_DEF ( ID INTEGER )
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ID" nullable="FALSE" />
+ <schema-createSequence name="RHQ_BUNDLE_DEPLOY_DEF_ID_SEQ" initial="10001" />
+ <schema-directSQL>
+ <statement desc="Creating primary key for RHQ_BUNDLE_DEPLOY_DEF">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_DEF ADD PRIMARY KEY ( ID )
+ </statement>
+ </schema-directSQL>
-
++
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="NAME" columnType="VARCHAR2" precision="200" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="NAME" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="NAME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="DESCRIPTION" columnType="VARCHAR2" precision="500" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="CTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="CTIME" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="CTIME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="MTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="MTIME" nullable="FALSE" />
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="CONFIG_ID" columnType="INTEGER" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="MTIME" nullable="FALSE" />
++ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="CONFIG_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY_DEF foreign key relation to RHQ_CONFIG">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_DEF
+ ADD CONSTRAINT RHQ_CONFIG_ID_FK
+ FOREIGN KEY (CONFIG_ID)
+ REFERENCES RHQ_CONFIG (ID)
+ </statement>
+ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ENFORCE_POLICY" columnType="BOOLEAN" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ENFORCE_POLICY" nullable="FALSE" />
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ENFORCEMENT_INTERVAL" columnType="INTEGER" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ENFORCE_POLICY" nullable="FALSE" />
++ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="ENFORCEMENT_INTERVAL" columnType="INTEGER" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="BUNDLE_VERSION_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="BUNDLE_VERSION_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY_DEF foreign key relation to RHQ_BUNDLE_VERSION">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_DEF
+ ADD CONSTRAINT RHQ_BUNDLE_VERSION_ID_FK
+ FOREIGN KEY (BUNDLE_VERSION_ID)
+ REFERENCES RHQ_BUNDLE_VERSION (ID)
+ </statement>
+ </schema-directSQL>
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="BUNDLE_ID" columnType="INTEGER" />
++ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_DEF" column="BUNDLE_ID" columnType="INTEGER" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY_DEF foreign key relation to RHQ_BUNDLE">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_DEF
+ ADD CONSTRAINT RHQ_BUNDLE_ID_FK
+ FOREIGN KEY (BUNDLE_ID)
+ REFERENCES RHQ_BUNDLE (ID)
+ </statement>
- </schema-directSQL>
++ </schema-directSQL>
+
+ <!-- RHQ_BUNDLE_DEPLOY -->
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_BUNDLE_DEPLOY">
+ CREATE TABLE RHQ_BUNDLE_DEPLOY ( ID INTEGER )
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="ID" nullable="FALSE" />
+ <schema-createSequence name="RHQ_BUNDLE_DEPLOY_ID_SEQ" initial="10001" />
+ <schema-directSQL>
+ <statement desc="Creating primary key for RHQ_BUNDLE_DEPLOY">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY ADD PRIMARY KEY ( ID )
+ </statement>
+ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="BUNDLE_DEPLOY_DEF_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="BUNDLE_DEPLOY_DEF_ID" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="BUNDLE_DEPLOY_DEF_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY foreign key relation to BUNDLE_DEPLOY_DEF">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY
+ ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_DEF_ID_FK
+ FOREIGN KEY (BUNDLE_DEPLOY_DEF_ID)
+ REFERENCES RHQ_BUNDLE_DEPLOY_DEF (ID)
+ </statement>
- </schema-directSQL>
++ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="RESOURCE_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="RESOURCE_ID" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="RESOURCE_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY foreign key relation to RESOURCE">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY
+ ADD CONSTRAINT RHQ_RESOURCE_ID_FK
+ FOREIGN KEY (RESOURCE_ID)
+ REFERENCES RHQ_RESOURCE (ID)
+ </statement>
- </schema-directSQL>
++ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY" column="CTIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="CTIME" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY" column="CTIME" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY unique constraint on def-resource mapping">
+ CREATE UNIQUE INDEX RHQ_BUNDLE_DEPLOY_MAP_IX ON RHQ_BUNDLE_DEPLOY (BUNDLE_DEPLOY_DEF_ID, RESOURCE_ID)
+ </statement>
+ </schema-directSQL>
+
+ <!-- RHQ_BUNDLE_DEPLOY_HIST -->
+ <schema-directSQL>
+ <statement desc="Creating table RHQ_BUNDLE_DEPLOY_HIST">
+ CREATE TABLE RHQ_BUNDLE_DEPLOY_HIST ( ID INTEGER )
+ </statement>
+ </schema-directSQL>
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="ID" nullable="FALSE" />
+ <schema-createSequence name="RHQ_BUNDLE_DEPLOY_HIST_ID_SEQ" initial="10001" />
+ <schema-directSQL>
+ <statement desc="Creating primary key for RHQ_BUNDLE_DEPLOY_HIST">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_HIST ADD PRIMARY KEY ( ID )
+ </statement>
+ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="BUNDLE_DEPLOY_ID" columnType="INTEGER" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="BUNDLE_DEPLOY_ID" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="BUNDLE_DEPLOY_ID" nullable="FALSE" />
+ <schema-directSQL>
+ <statement desc="Creating RHQ_BUNDLE_DEPLOY_HIST foreign key relation to BUNDLE_DEPLOY">
+ ALTER TABLE RHQ_BUNDLE_DEPLOY_HIST
+ ADD CONSTRAINT RHQ_BUNDLE_DEPLOY_ID_FK
+ FOREIGN KEY (BUNDLE_DEPLOY_ID)
+ REFERENCES RHQ_BUNDLE_DEPLOY (ID)
+ </statement>
- </schema-directSQL>
++ </schema-directSQL>
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="SUBJECT_NAME" columnType="VARCHAR2" precision="255" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" columnType="LONG" />
- <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" nullable="FALSE" />
++ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_TIME" nullable="FALSE" />
+ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_ACTION" columnType="VARCHAR2" precision="50" />
+ <schema-alterColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_ACTION" nullable="FALSE" />
- <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_MESSAGE" columnType="LONGVARCHAR" />
-
++ <schema-addColumn table="RHQ_BUNDLE_DEPLOY_HIST" column="AUDIT_MESSAGE" columnType="LONGVARCHAR" />
++
+ <!-- Changes to RHQ_BUNDLE_FILE -->
+ <schema-alterColumn table="RHQ_BUNDLE_FILE" column="PACKAGE_VERSION_ID" nullable="FALSE" />
-
++
+ </schemaSpec>
+
+ <schemaSpec version="2.79">
+ <schema-directSQL>
+ <statement desc="Normalizing resource group descriptions">
+ UPDATE RHQ_RESOURCE_GROUP SET DESCRIPTION = NULL WHERE DESCRIPTION = ''
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --cc modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index acc7946,0908a0e..97fed67
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@@ -1,10 -1,61 +1,65 @@@
<?xml version="1.0" encoding="UTF-8"?>
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-- xsi:schemaLocation="http://jboss.com/products/seam/pages
++ xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.1.xsd">
+ <page view-id="/rhq/resource/alert/viewAlert.xhtml" action="#{alertNotificationStoreSelector.select('alertDefinitionNotificationStore')}" />
+
+ <page view-id="/rhq/resource/alert/notif/notificationTemplates.xhtml" action="#{alertNotificationStoreSelector.select('alertNotificationTemplateStore')}" />
++
+ <page view-id="/rhq/resource/configuration/view.xhtml">
+ <action execute="#{configurationViewer.initialize}" on-postback="false"/>
+
+ <navigation from-action="#{ConfigHelperUIBean.accessMap}">
+ <redirect view-id="/rhq/resource/configuration/view-map.xhtml">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ <param name="listName" value="#{param.listName}"/>
+ <param name="listIndex" value="#{param.listIndex}"/>
+ </redirect>
+ </navigation>
+ </page>
+
+ <page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
+
+ <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="15000" timeout="180000">
+ <action execute="#{configurationEditor.initialize}"
+ on-postback="false"
+ if="#{!conversation.longRunning or (empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id)}"/>
+
+ <navigation from-action="#{configurationEditor.initialize}">
+ <rule if="#{configurationEditor.initialized}">
+ <begin-conversation join="true"/>
+ </rule>
+
+ <rule if="#{configurationEditor.updateInProgress}">
+ <redirect view-id="/rhq/resource/configuration/view.xhtml" include-page-params="true">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ </redirect>
+ </rule>
+ </navigation>
+
+ <navigation from-action="#{configurationEditor.updateConfiguration}">
+ <!-- success out is used for both success and in progress update statuses -->
+ <rule if-outcome="success">
+ <end-conversation before-redirect="false"/>
+ <redirect view-id="/rhq/resource/configuration/history.xhtml">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ </redirect>
+ </rule>
+
+ <rule if-outcome="#{nochange or failure}">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </rule>
+ </navigation>
+
+ <navigation from-action="#{configurationEditor.finishAddMap}">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </navigation>
+
+ <navigation from-action="#{configurationEditor.finishEditMap}">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </navigation>
+ </page>
+
</pages>
diff --cc modules/enterprise/server/plugins/pom.xml
index eb03f07,abec716..09640ea
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@@ -60,27 -63,24 +63,28 @@@
<!-- needed for referenced domain entities that use Hibernate annotations -->
</dependency>
</dependencies>
-
- <modules>
- <module>disk</module>
- <module>yum</module>
- <module>url</module>
- <module>rhnhosted</module>
- <module>jboss-software</module>
- <module>perspectives/core</module>
- <module>alert-email</module>
- <module>alert-irc</module>
- <module>alert-mobicents</module>
- <module>alert-microblog</module>
- <module>alert-roles</module>
- <module>alert-snmp</module>
- <module>alert-subject</module>
- <module>cobbler</module>
- <module>filetemplate-bundle</module>
- <module>validate-all-serverplugins</module>
- </modules>
+ <modules>
+ <module>disk</module>
+ <module>yum</module>
+ <module>url</module>
+ <module>rhnhosted</module>
+ <module>jboss-software</module>
+ <module>perspectives/core</module>
+ <module>alert-email</module>
+ <module>alert-irc</module>
+ <module>alert-mobicents</module>
+ <module>alert-microblog</module>
+ <module>alert-operations</module>
+ <module>alert-roles</module>
+ <module>alert-scriptlang</module>
+ <!-- Seeing strange issues with corrupt jar dependencies...
+ <module>alert-sms</module>
+ -->
+ <module>alert-snmp</module>
+ <module>alert-subject</module>
+ <module>cobbler</module>
++ <module>filetemplate-bundle</module>
+ <module>validate-all-serverplugins</module>
+ </modules>
- </project>
+ </project>
commit 900d25467b3540eba3147e933bf29552b104082c
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 17 08:23:25 2010 -0500
Fixing unit test that needed to be updated to support new validation logic
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
index fa50d29..216bd81 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
@@ -254,18 +254,23 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
final Sequence configUdpate = context.sequence("structured-config-update");
context.checking(new Expectations() {{
+ allowing(authorizationMgr).canViewResource(fixture.subject, fixture.resourceId); will(returnValue(true));
+
allowing(entityMgr).find(Resource.class, fixture.resourceId); will(returnValue(fixture.resource));
+ allowing(agentMgr).getAgentClient(expectedUpdate.getResource().getAgent()); will(returnValue(agentClient));
+
+ allowing(agentClient).getConfigurationAgentService(); will(returnValue(configAgentService));
+
+ oneOf(configAgentService).validate(fixture.configuration, fixture.resourceId, FROM_STRUCTURED);
+ inSequence(configUdpate);
+
oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(),
fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
inSequence(configUdpate);
- allowing(agentMgr).getAgentClient(expectedUpdate.getResource().getAgent()); will(returnValue(agentClient));
-
- allowing(agentClient).getConfigurationAgentService(); will(returnValue(configAgentService));
-
oneOf(configAgentService).updateResourceConfiguration(with(matchingUpdateRequest(expectedUpdateRequest)));
inSequence(configUdpate);
}});
commit 49f814a845d36418c4a6afda317641c1e647a6e2
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Wed Feb 17 13:19:12 2010 +0100
Lens loading error fix.
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java
index e9997bc..903b370 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.apache;
import java.util.ArrayList;
@@ -26,7 +48,6 @@ import org.rhq.plugins.apache.mapping.ApacheAugeasMapping;
import org.rhq.plugins.apache.util.AugeasNodeSearch;
-
public class ApacheIfModuleComponent implements ResourceComponent<ApacheVirtualHostServiceComponent>, ConfigurationFacet, DeleteResourceFacet {
private AugeasTree tree;
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
index 0a45cfd..cc8cb16 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.apache;
import java.util.ArrayList;
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java
index 87cb22e..3a04a34 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.apache;
import java.util.LinkedHashSet;
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java
index 80b25b1..ea53b87 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.apache;
import java.util.LinkedHashSet;
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java
index 9102e0a..a205296 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.plugins.apache.augeas.mappingImpl;
import java.util.List;
diff --git a/modules/plugins/apache/src/main/resources/Httpd.aug b/modules/plugins/apache/src/main/resources/Httpd.aug
deleted file mode 100644
index 668313b..0000000
--- a/modules/plugins/apache/src/main/resources/Httpd.aug
+++ /dev/null
@@ -1,58 +0,0 @@
-module Httpd =
- autoload xfm
-
-(* Helpers *)
-
-(* Newlines can be escaped. *)
-let sep = del /([ \t]+(\\\\\n)?)+/ " "
-let eol = del /([ \t]*(\\\\\n)?)*\n/ "\n"
- let del_str (s:string) = del s s
-let ws = /[ \t]*/
-let alnum = /[a-zA-Z0-9_]+/
-(* the last character in the non-quoted word must not be a backslash. I guess this is not completely semantically
- correct but at the same time, apache discourages to use backslashes for anything else than
- line breaking so we should be safe here. This restriction is in place to support
- escaped new lines in the sep and eol rules. *)
-let word = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n]*[^'" \t\n\\]/
-let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'\" \t\n>]+/
-let wskey (k:regexp) = del ws "" . key k
-let params (param:regexp) = [ sep . label "param" . store param ]*
-let sec (name:string) (body:lens) =
- [ wskey ("<" . name) . params secarg . del_str ">" . eol .
- body . del ws "" . del_str("</" . name . ">") . eol ]
-
-(* Definitions *)
-let comment = [ del /([ \t]*(#.*)*)\n/ "#\n" ]
-
-let directive = [ wskey alnum . params word . eol ]
-
-let section (name:string) = sec name (directive|comment)*
-
-let sections (body:lens) = sec "Directory" body
- | sec "DirectoryMatch" body
- | sec "Files" body
- | sec "FilesMatch" body
- | sec "Location" body
- | sec "LocationMatch" body
- | sec "AuthnProviderAlias" body
- | sec "IfDefine" body
- | sec "IfVersion" body
- | sec "Limit" body
- | sec "LimitExcept" body
- | sec "Proxy" body
- | sec "ProxyMatch" body
- | sec "VirtualHost" body
- | sec "IfModule" body
-
-
-(* What we want ot say is *)
-(* let rec body = (directive|comment)* | ifModule body | directory body | ... *)
-(* but we can't typecheck that *)
-
-(* FIXME: *)
-(* - Nesting of sections *)
-let rec lns = ((directive | comment)* | sections lns)*
-
-let filter =
- incl "/etc/httpd/conf/httpd.conf"
-let xfm = transform lns filter
diff --git a/modules/plugins/apache/src/main/resources/httpd.aug b/modules/plugins/apache/src/main/resources/httpd.aug
new file mode 100644
index 0000000..668313b
--- /dev/null
+++ b/modules/plugins/apache/src/main/resources/httpd.aug
@@ -0,0 +1,58 @@
+module Httpd =
+ autoload xfm
+
+(* Helpers *)
+
+(* Newlines can be escaped. *)
+let sep = del /([ \t]+(\\\\\n)?)+/ " "
+let eol = del /([ \t]*(\\\\\n)?)*\n/ "\n"
+ let del_str (s:string) = del s s
+let ws = /[ \t]*/
+let alnum = /[a-zA-Z0-9_]+/
+(* the last character in the non-quoted word must not be a backslash. I guess this is not completely semantically
+ correct but at the same time, apache discourages to use backslashes for anything else than
+ line breaking so we should be safe here. This restriction is in place to support
+ escaped new lines in the sep and eol rules. *)
+let word = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n]*[^'" \t\n\\]/
+let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'\" \t\n>]+/
+let wskey (k:regexp) = del ws "" . key k
+let params (param:regexp) = [ sep . label "param" . store param ]*
+let sec (name:string) (body:lens) =
+ [ wskey ("<" . name) . params secarg . del_str ">" . eol .
+ body . del ws "" . del_str("</" . name . ">") . eol ]
+
+(* Definitions *)
+let comment = [ del /([ \t]*(#.*)*)\n/ "#\n" ]
+
+let directive = [ wskey alnum . params word . eol ]
+
+let section (name:string) = sec name (directive|comment)*
+
+let sections (body:lens) = sec "Directory" body
+ | sec "DirectoryMatch" body
+ | sec "Files" body
+ | sec "FilesMatch" body
+ | sec "Location" body
+ | sec "LocationMatch" body
+ | sec "AuthnProviderAlias" body
+ | sec "IfDefine" body
+ | sec "IfVersion" body
+ | sec "Limit" body
+ | sec "LimitExcept" body
+ | sec "Proxy" body
+ | sec "ProxyMatch" body
+ | sec "VirtualHost" body
+ | sec "IfModule" body
+
+
+(* What we want ot say is *)
+(* let rec body = (directive|comment)* | ifModule body | directory body | ... *)
+(* but we can't typecheck that *)
+
+(* FIXME: *)
+(* - Nesting of sections *)
+let rec lns = ((directive | comment)* | sections lns)*
+
+let filter =
+ incl "/etc/httpd/conf/httpd.conf"
+let xfm = transform lns filter
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/AugeasTreeBuilder.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/AugeasTreeBuilder.java
index e55739b..898005a 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/AugeasTreeBuilder.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/AugeasTreeBuilder.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.augeas.tree;
import org.rhq.augeas.AugeasProxy;
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java
index c5cd855..5153145 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/tree/impl/DefaultAugeasTreeBuilder.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.augeas.tree.impl;
import java.io.File;
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
index f610726..1fc9abd 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.augeas.util;
import java.io.File;
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
index 2927d02..f104cbb 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
@@ -1,3 +1,25 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.augeas.util;
import java.io.File;
@@ -70,13 +92,14 @@ public class LensHelper {
return (String)System.getProperties().get(TEMP_DIRECTORY);
}
- public static File cpFileFromPluginToTemp(File tempDirectory,String fileName) throws IOException,Exception{
+ public static File cpFileFromPluginToTemp(ClassLoader loader,File tempDirectory,String fileName) throws IOException,Exception{
File destinationFile = new File(tempDirectory,fileName);
if (!destinationFile.exists())
{
destinationFile.createNewFile();
- InputStream input = tempDirectory.getClass().getClassLoader().getResourceAsStream(fileName);
+
+ InputStream input = loader.getResourceAsStream(fileName);
copyFile(input, destinationFile);
}
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java b/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
index 6dc7b7b..33e0f38 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
@@ -93,7 +93,8 @@ public class PluginDescriptorBasedAugeasConfiguration implements AugeasConfigura
AugeasModuleConfig config = new AugeasModuleConfig();
config.setIncludedGlobs(includes);
config.setExcludedGlobs(excludes);
- LensHelper.cpFileFromPluginToTemp(tempDir, augeasModuleName+".aug");
+ String modName = Character.toLowerCase(augeasModuleName.charAt(0))+augeasModuleName.substring(1);
+ LensHelper.cpFileFromPluginToTemp(this.getClass().getClassLoader(),tempDir, modName+".aug");
config.setLensPath(getAugeasModuleName(pluginConfiguration) + ".lns");
config.setModuletName(getAugeasModuleName(pluginConfiguration));
modules.add(config);
commit 1826981768e1fb2493c4567c0e9437b39d6bb02c
Merge: b729a70... e0ada02...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Wed Feb 17 12:51:03 2010 +0100
Merge branch 'alertPlugin' of ssh://git.fedorahosted.org/git/rhq/rhq into alertPlugin
commit cc17f95148b281929c6957ad612c56193aafa60d
Merge: ae5a157... 5f217ae...
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Feb 16 18:13:40 2010 -0500
Fixed merge conflicts
diff --cc modules/enterprise/server/ear/pom.xml
index 4ae7211,175420d..11f5ae2
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@@ -226,12 -226,6 +226,11 @@@
</goals>
<configuration>
<artifactItems>
-
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-agent-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
@@@ -304,90 -245,7 +303,35 @@@
<version>${project.version}</version>
</artifactItem>
- <!-- NOTE: The rest of the plugins are copied by enabled-by-default profiles defined below. -->
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-mysql-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-netservices-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-oracle-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-perftest-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-platform-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-postfix-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-postgres-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-samba-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-script-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-snmptrapd-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-sshd-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-sudoers-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-virt-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-kickstart-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
</artifactItems>
<outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
</configuration>
commit 5f217ae06f42ff9d0abcb9bcd88f53faed62afc1
Merge: e7002d8... 7c45005...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 16 17:35:48 2010 -0500
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit e7002d8dcfce20b72835004c15cb75c1b9b9f5c1
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 16 17:35:25 2010 -0500
Changed unit tests to refelct current approach to validation.
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 6c74811..9a08bae 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
@@ -23,11 +23,20 @@
package org.rhq.core.pc.configuration;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+import java.util.concurrent.ScheduledExecutorService;
+
import org.hamcrest.Matcher;
import org.jmock.Expectations;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -38,15 +47,6 @@ import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.test.jmock.PropertyMatcher;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.Set;
-import java.util.concurrent.ScheduledExecutorService;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
public class ConfigurationManagerTest extends ConfigManagementTest {
@@ -323,13 +323,11 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
});
try {
configurationMgr.validate(configuration, resourceId, false);
- assertTrue(false);
} catch (PluginContainerException exception) {
- //SUCCESS
+ assertTrue(false, "Validate should have caught the exception.");
}
}
-
@Test
public void catchExceptionThrownByFailedValidationOfStructuredConfigs() throws Exception {
@@ -354,15 +352,11 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
});
try {
configurationMgr.validate(configuration, resourceId, true);
- assertTrue(false);
} catch (PluginContainerException exception) {
- //SUCCESS
+ assertTrue(false, "validate should have caught exception");
}
}
-
-
-
@Test
public void mergingRawsIntoStructuredShouldIgnoreNull() throws Exception {
Configuration config = new Configuration();
commit e0ada029b2a617668c5ab9cfd4e3eeae85c347b6
Author: Justin Harris <jharris(a)redhat.com>
Date: Tue Feb 16 17:17:52 2010 -0500
Adding in create alert page.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
index 9ac7e65..1d5fe02 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
@@ -28,6 +28,7 @@ import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDampening.TimeUnits;
import org.rhq.core.domain.alert.AlertDefinition;
@@ -56,28 +57,20 @@ public class AlertConditionUIBean {
@In("#{webUser.subject}")
private Subject subject;
-
@In
private ResourceType resourceType;
-
@In
private AlertDefinition alertDefinition;
-
@In
private AlertDefinitionManagerLocal alertDefinitionManager;
-
@In
private MeasurementDefinitionManagerLocal measurementDefinitionManager;
-
@In
private OperationManagerLocal operationManager;
-
@In
private MeasurementScheduleManagerLocal measurementScheduleManager;
-
@In
private Map<String, String> messages;
-
private Map<String, String> conditionExpressions;
private Map<String, String> availabilities;
private Map<String, String> severities;
@@ -92,6 +85,7 @@ public class AlertConditionUIBean {
private Map<String, String> dampeningCategories;
private Map<String, String> timeUnits;
+ private Integer resourceId;
public Map<String, String> getConditionExpressions() {
return conditionExpressions;
@@ -141,6 +135,21 @@ public class AlertConditionUIBean {
return timeUnits;
}
+ @RequestParameter("id")
+ public void setResourceId(Integer resourceId) {
+ if (resourceId != null) {
+ this.resourceId = resourceId;
+ }
+ }
+
+ public Integer getResourceId() {
+ if (this.alertDefinition != null && this.alertDefinition.getResource() != null) {
+ return this.alertDefinition.getResource().getId();
+ }
+
+ return this.resourceId;
+ }
+
@Create
public void init() {
this.conditionExpressions = createBooleanMap();
@@ -171,7 +180,7 @@ public class AlertConditionUIBean {
Map<String, Integer> alertsMap = new HashMap<String, Integer>();
PageList<AlertDefinition> alerts = alertDefinitionManager.findAlertDefinitions(subject,
- this.alertDefinition.getResource().getId(), PageControl.getUnlimitedInstance());
+ getResourceId(), PageControl.getUnlimitedInstance());
for (AlertDefinition alert : alerts) {
alertsMap.put(alert.getName(), alert.getId());
@@ -225,7 +234,7 @@ public class AlertConditionUIBean {
}
List<MeasurementSchedule> schedules = measurementScheduleManager.findSchedulesByResourceIdAndDefinitionIds(subject,
- this.alertDefinition.getResource().getId(), definitionIds);
+ getResourceId(), definitionIds);
for (MeasurementSchedule schedule : schedules) {
baselineMap.put(getLabel(MeasurementConstants.BASELINE_OPT_MIN, schedule), MeasurementConstants.BASELINE_OPT_MIN);
@@ -244,8 +253,9 @@ public class AlertConditionUIBean {
private Map<String, Integer> lookupMeasurements(DataType type) {
Map<String, Integer> measurementMap = new HashMap<String, Integer>();
- List<MeasurementDefinition> definitions = this.measurementDefinitionManager.findMeasurementDefinitionsByResourceType(subject,
- resourceType.getId(), type, null);
+ List<MeasurementDefinition> definitions =
+ this.measurementDefinitionManager.findMeasurementDefinitionsByResourceType(
+ subject, resourceType.getId(), type, null);
for (MeasurementDefinition definition : definitions) {
measurementMap.put(definition.getDisplayName(), definition.getId());
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
index 00ea5eb..f3365f0 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
@@ -30,6 +30,7 @@ import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.international.StatusMessage.Severity;
import org.jboss.seam.log.Log;
@@ -52,31 +53,22 @@ public class AlertConditionsUIBean {
@Logger
private Log log;
-
@In
private FacesMessages facesMessages;
-
@In("#{webUser.subject}")
private Subject subject;
-
@In
private ResourceType resourceType;
-
@In
private AlertDefinitionManagerLocal alertDefinitionManager;
-
@In
private MeasurementDefinitionManagerLocal measurementDefinitionManager;
-
@In
private ConfigurationManagerLocal configurationManager;
-
@In
private AlertDefinition alertDefinition;
-
@In
private AlertDescriber alertDescriber;
-
private MetricAbsoluteConverter metricAbsoluteConverter = new MetricAbsoluteConverter();
private Map<AlertConditionCategory, String> categories;
private List<ConditionDescription> conditionDescriptions;
@@ -84,6 +76,14 @@ public class AlertConditionsUIBean {
private Integer measurementDefinitionId = 0;
private Double threshold;
+ private Integer resourceId;
+
+ @RequestParameter("id")
+ public void setResourceId(Integer resourceId) {
+ if (resourceId != null) {
+ this.resourceId = resourceId;
+ }
+ }
public String getMeasurementDefinitionId() {
return measurementDefinitionId.toString();
@@ -125,7 +125,10 @@ public class AlertConditionsUIBean {
if (measurement != null) {
setMeasurementDefinitionId(Integer.toString(measurement.getId()));
- this.threshold = metricAbsoluteConverter.getForDisplay(this.currentCondition.getThreshold(), measurement);
+
+ if (this.currentCondition.getCategory() == AlertConditionCategory.THRESHOLD) {
+ this.threshold = metricAbsoluteConverter.getForDisplay(this.currentCondition.getThreshold(), measurement);
+ }
}
}
}
@@ -147,19 +150,11 @@ public class AlertConditionsUIBean {
return descriptions;
}
- public void addCondition() {
+ public void createCondition() {
setCurrentCondition(new AlertCondition());
}
- public String removeCondition() {
- this.conditionDescriptions.remove(findCurrentDescription());
- setCurrentCondition(null);
-
- // persist to DB
- return saveConditions();
- }
-
- public String saveConditions() {
+ public void updateCondition() {
if (shouldSetMeasurementDefinition()) {
MeasurementDefinition measurementDefinition = this.measurementDefinitionManager.getMeasurementDefinition(subject, this.measurementDefinitionId);
currentCondition.setMeasurementDefinition(measurementDefinition);
@@ -170,24 +165,46 @@ public class AlertConditionsUIBean {
}
}
- Set<AlertCondition> conditions = findConditions();
+ for (ConditionDescription description : conditionDescriptions) {
+ if (description.condition.equals(this.currentCondition)) {
+ description.description = this.alertDescriber.describeCondition(description.condition);
- // in case of a newly added condition
- if (this.currentCondition != null && !conditions.contains(this.currentCondition)) {
- conditions.add(this.currentCondition);
+ return;
+ }
}
- alertDefinition.setConditions(conditions);
+ // otherwise, this is a new condition
+ this.conditionDescriptions.add(new ConditionDescription(this.currentCondition));
+ }
- return saveAlertDefinition();
+ public void removeCondition() {
+ this.conditionDescriptions.remove(findCurrentDescription());
+ setCurrentCondition(null);
}
public String saveAlertDefinition() {
+ alertDefinition.setConditions(findConditions());
+
try {
alertDefinitionManager.updateAlertDefinition(subject, alertDefinition.getId(), alertDefinition, true);
} catch(Exception e) {
this.facesMessages.add(Severity.ERROR, "There was an error saving the alert conditions.");
- this.log.error("Error persisting AlertCondition on AlertDefinition: " + alertDefinition.getName(), e);
+ this.log.error("Error persisting AlertDefinition: " + alertDefinition.getName(), e);
+
+ return null;
+ }
+
+ return SUCCESS_OUTCOME;
+ }
+
+ public String newAlertDefinition() {
+ alertDefinition.setConditions(findConditions());
+
+ try {
+ alertDefinitionManager.createAlertDefinition(subject, alertDefinition, resourceId);
+ } catch(Exception e) {
+ this.facesMessages.add(Severity.ERROR, "There was an error creating the alert definitino.");
+ this.log.error("Error persisting AlertDefinition: " + alertDefinition.getName(), e);
return null;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
index d46c114..436cfc9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
@@ -26,6 +26,7 @@ import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
@@ -45,8 +46,13 @@ public class AlertDefinitionComponent implements Serializable {
@Unwrap
public AlertDefinition lookupAlertDefinition() {
- if (this.alertDefinitionId != null) {
- this.alertDefinition = this.alertDefinitionManager.getAlertDefinitionById(this.subject , this.alertDefinitionId);
+ if (this.alertDefinition == null) {
+ if (this.alertDefinitionId != null) {
+ this.alertDefinition = this.alertDefinitionManager.getAlertDefinitionById(this.subject , this.alertDefinitionId);
+ } else {
+ this.alertDefinition = new AlertDefinition();
+ this.alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
+ }
}
return this.alertDefinition;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertPrioritiesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertPrioritiesUIBean.java
new file mode 100644
index 0000000..f4cfe82
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertPrioritiesUIBean.java
@@ -0,0 +1,48 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.faces.model.SelectItem;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.core.domain.alert.AlertPriority;
+
+(a)Scope(ScopeType.APPLICATION)
+@Name("alertPrioritiesUIBean")
+public class AlertPrioritiesUIBean {
+
+ private List<SelectItem> priorities;
+
+ public List<SelectItem> getPriorities() {
+ return priorities;
+ }
+
+ @Create
+ public void lookupPriorities() {
+ this.priorities = new ArrayList<SelectItem>();
+
+ for (AlertPriority priority : AlertPriority.values()) {
+ this.priorities.add(new SelectItem(priority.name(), priority.getDisplayName()));
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
index 48f3cee..f3d97c3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
@@ -22,7 +22,6 @@ package org.rhq.enterprise.gui.alert;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import javax.faces.model.SelectItem;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
@@ -34,7 +33,6 @@ import org.jboss.seam.log.Log;
import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertDefinitionUpdateException;
@@ -62,7 +60,6 @@ public class AlertUIBean implements Serializable {
private AlertDefinition alertDefinition;
private List<String> alertConditions;
private String alertDampening;
- private List<SelectItem> priorities;
public String getAlertDampening() {
return this.alertDampening;
@@ -80,10 +77,6 @@ public class AlertUIBean implements Serializable {
return alertConditions;
}
- public List<SelectItem> getPriorities() {
- return this.priorities;
- }
-
public String saveAlertDefinition() {
try {
alertDefinitionManager.updateAlertDefinition(this.subject,
@@ -103,7 +96,6 @@ public class AlertUIBean implements Serializable {
public void init() {
this.alertConditions = lookupAlertConditions();
this.alertDampening = lookupAlertDampening();
- this.priorities = lookupPriorities();
}
private List<String> lookupAlertConditions() {
@@ -121,14 +113,4 @@ public class AlertUIBean implements Serializable {
return this.alertDescriber.describeDampening(dampening);
}
-
- private List<SelectItem> lookupPriorities() {
- List<SelectItem> items = new ArrayList<SelectItem>();
-
- for (AlertPriority priority : AlertPriority.values()) {
- items.add(new SelectItem(priority.name(), priority.getDisplayName()));
- }
-
- return items;
- }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java
index f173d5f..9f696d5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java
@@ -24,23 +24,46 @@ import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@AutoCreate
-(a)Scope(ScopeType.EVENT)
+(a)Scope(ScopeType.PAGE)
@Name("resourceType")
public class ResourceTypeComponent {
+ @RequestParameter("id")
+ private Integer resourceId;
+
+ @In("#{webUser.subject}")
+ private Subject subject;
+
+ @In
+ private ResourceManagerLocal resourceManager;
+
@In
private AlertDefinition alertDefinition;
+ private ResourceType resourceType;
+
@Unwrap
public ResourceType lookupResourceType() {
if (this.alertDefinition.getResource() != null) {
- return this.alertDefinition.getResource().getResourceType();
+ this.resourceType = this.alertDefinition.getResource().getResourceType();
+ } else if (this.alertDefinition.getResourceGroup() != null) {
+ this.resourceType = this.alertDefinition.getResourceGroup().getResourceType();
+ } else if (this.resourceId != null) {
+ Resource resource = this.resourceManager.getResource(this.subject, this.resourceId);
+
+ if (resource != null) {
+ this.resourceType = resource.getResourceType();
+ }
}
- return this.alertDefinition.getResourceGroup().getResourceType();
+ return this.resourceType;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
index c62c163..a9dd7b4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
@@ -17,7 +17,7 @@
<navigation-case>
<from-outcome>createNewAlertDefinition</from-outcome>
- <to-view-id>/alerts/Config.do?id=#{param.id}&mode=new</to-view-id>
+ <to-view-id>/rhq/resource/alert/newAlert.xhtml?id=#{param.id}</to-view-id>
<redirect/>
</navigation-case>
@@ -124,11 +124,25 @@
<navigation-case>
<from-outcome>success</from-outcome>
- <to-view-id>/rhq/resource/alert/listConditions.xhtml?ad=#{alertDefinition.id}</to-view-id>
+ <to-view-id>/rhq/resource/alert/viewAlert.xhtml?ad=#{alertDefinition.id}</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/resource/alert/newAlert.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/resource/alert/viewAlert.xhtml?ad=#{alertDefinition.id}</to-view-id>
+
+ <redirect />
+ </navigation-case>
+
+ </navigation-rule>
+
+
</faces-config>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml
new file mode 100644
index 0000000..9439c5f
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/alertDefinitionProperties.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<ui:component xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <h:panelGrid columns="2" border="1" cellpadding="5" style="margin: 15px;">
+ <h:outputLabel for="alertNameInput" value="Name: " />
+ <h:inputText id="alertNameInput" value="#{alertDefinition.name}" style="width: 300px;" />
+
+ <h:outputLabel for="alertDescriptionInput" value="Description: " />
+ <h:inputTextarea id="alertDescriptionInput" value="#{alertDefinition.description}" style="width: 300px;" />
+
+ <h:outputLabel for="alertPriorityInput" value="Priority: " />
+ <h:selectOneMenu id="alertPriorityInput" value="#{alertDefinition.priority}">
+ <f:selectItems value="#{alertPrioritiesUIBean.priorities}" />
+ </h:selectOneMenu>
+
+ <h:outputLabel for="alertEnabledInput" value="Active: " />
+ <h:selectBooleanCheckbox id="alertEnabledInput" value="#{alertDefinition.enabled}" />
+ </h:panelGrid>
+</ui:component>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
index e4e938d..24a0bdf 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
@@ -29,13 +29,15 @@
</h:outputLink>
<h:outputText value=">" />
<h:outputLink value="viewAlert.xhtml">
- <f:param name="ad" value="#{param.ad}" />
+ <f:param name="ad" value="#{alertDefinition.id}" />
<h:outputText value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'" />
</h:outputLink>
</ui:define>
<ui:define name="body">
- <a4j:form>
+ <a4j:form id="alertConditionsForm">
+ <ui:insert name="formTop" />
+
<rich:panel id="conditionsPanel">
<f:facet name="header">
<h:outputText value="Alert Conditions"/>
@@ -80,6 +82,7 @@
reRender="categoryTable">
<f:setPropertyActionListener value="#{conditionDescription.condition}" target="#{alertConditionsUIBean.currentCondition}" />
+ <a4j:support event="onclick" reRender="categoryTable" />
</a4j:commandButton>
</rich:column>
</rich:dataTable>
@@ -87,7 +90,7 @@
<br />
<a4j:commandButton id="addConditionButton"
value="Add a new Condition"
- action="#{alertConditionsUIBean.addCondition}"
+ action="#{alertConditionsUIBean.createCondition}"
styleClass="buttonmed">
<rich:componentControl for="categoryModalPanel" attachTo="addConditionButton" operation="show" event="onclick" />
<a4j:support event="onclick" reRender="categoryOptionsPanel" />
@@ -179,10 +182,14 @@
</a4j:status>
</rich:panel>
- <h:commandButton id="saveButton"
- value="OK"
- action="#{alertConditionsUIBean.saveAlertDefinition}"
- styleClass="buttonmed" />
+
+ <ui:insert name="actionButton">
+ <h:commandButton id="saveButton"
+ value="OK"
+ action="#{alertConditionsUIBean.saveAlertDefinition}"
+ styleClass="buttonmed"
+ style="margin: 10px;" />
+ </ui:insert>
</a4j:form>
<rich:modalPanel id="categoryModalPanel" moveable="false" autosized="true" width="400">
@@ -208,7 +215,7 @@
</f:facet>
<f:facet name="stop">
- <h:form>
+ <a4j:form id="EditConditionForm">
<rich:panel id="categoryOptions" style="width: %100;">
<ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'CONTROL'}">
@@ -329,16 +336,18 @@
<h:commandButton id="categoryOptionOkButton"
value="OK"
- action="#{alertConditionsUIBean.saveConditions}"
+ action="#{alertConditionsUIBean.updateCondition}"
styleClass="buttonmed"
style="margin: 5px;">
+ <rich:componentControl for="categoryModalPanel" attachTo="categoryOptionOkButton" operation="hide" event="onclick" />
+ <a4j:support event="onclick" reRender="categoryTable" />
</h:commandButton>
<h:outputLink id="conditionCancelLink" styleClass="buttonmed" value="#" style="float: right; margin: 5px;">
<h:outputText value="Cancel" />
<rich:componentControl for="categoryModalPanel" attachTo="conditionCancelLink" operation="hide" event="onclick" />
</h:outputLink>
- </h:form>
+ </a4j:form>
</f:facet>
</a4j:status>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/newAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/newAlert.xhtml
new file mode 100644
index 0000000..20b0f39
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/newAlert.xhtml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+
+ <ui:composition template="/rhq/resource/alert/listConditions.xhtml">
+ <ui:param name="pageTitle" value="New Alert Definition"/>
+
+ <ui:define name="breadcrumbs">
+ <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
+ <f:param name="id" value="#{alertConditionUIBean.resourceId}"/>
+ <h:outputText>Alert Definitions</h:outputText>
+ </h:outputLink>
+ <h:outputText> > </h:outputText>
+ <h:outputLink value="newAlert.xhtml">
+ <f:param name="id" value="#{alertConditionUIBean.resourceId}" />
+ <h:outputText value="New Alert Definition"/>
+ </h:outputLink>
+ </ui:define>
+
+ <ui:define name="formTop">
+ <ui:include src="alertDefinitionProperties.xhtml" />
+ </ui:define>
+
+ <ui:define name="actionButton">
+ <h:commandButton id="createButton"
+ value="Create Alert"
+ action="#{alertConditionsUIBean.newAlertDefinition}"
+ styleClass="buttonmed"
+ style="margin: 10px;" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 0309174..dcfff68 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -46,7 +46,7 @@
</h:outputLink>
<h:outputText> > </h:outputText>
<h:outputLink value="viewAlert.xhtml">
- <f:param name="ad" value="#{param.ad}" />
+ <f:param name="ad" value="#{alertDefinition.id}" />
<h:outputText value=" Definition for '#{alertDefinition.name}' "/>
</h:outputLink>
<h:outputText> on resource </h:outputText>
@@ -216,21 +216,7 @@
<h:form id="editAlertDefinitionForm">
<input type="hidden" name="ad" value="#{param.ad}" />
- <h:panelGrid columns="2" border="1" cellpadding="5" style="margin: 15px;">
- <h:outputLabel for="alertNameInput" value="Name: " />
- <h:inputText id="alertNameInput" value="#{alertUIBean.alertDefinition.name}" style="width: 300px;" />
-
- <h:outputLabel for="alertDescriptionInput" value="Description: " />
- <h:inputTextarea id="alertDescriptionInput" value="#{alertUIBean.alertDefinition.description}" style="width: 300px;" />
-
- <h:outputLabel for="alertPriorityInput" value="Priority: " />
- <h:selectOneMenu id="alertPriorityInput" value="#{alertUIBean.alertDefinition.priority}">
- <f:selectItems value="#{alertUIBean.priorities}" />
- </h:selectOneMenu>
-
- <h:outputLabel for="alertEnabledInput" value="Active: " />
- <h:selectBooleanCheckbox id="alertEnabledInput" value="#{alertUIBean.alertDefinition.enabled}" />
- </h:panelGrid>
+ <ui:include src="alertDefinitionProperties.xhtml" />
<h:outputLink id="editDefinitionCancelLink" styleClass="buttonmed" value="#" style="float: right;">
<h:outputText value="Cancel" />
commit 7c4500514c447c6be3a2d9c191b8ca4b9f70ce53
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Feb 16 16:54:07 2010 -0500
add support for optional plugin profiles to ear/pom.xml and remove hudson module from linux-plugins profile in plugins/pom.xml
(cherry picked from commit fe17e6f371b816d6b5cb453219246a18928c2f21)
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index bb2ff06..175420d 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -219,7 +219,7 @@
<executions>
<execution>
- <id>copy-rhq-plugins</id>
+ <id>copy-core-plugins</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
@@ -229,159 +229,23 @@
<artifactItem>
<groupId>org.rhq</groupId>
- <artifactId>rhq-agent-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-aliases-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-apache-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-augeas-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-cron-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-database-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-grub-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-hosts-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-hudson-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-iis-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <!--
- TODO: Uncomment once errors from RHQ-1226 are fixed. <artifactItem>
- <groupId>org.rhq</groupId> <artifactId>rhq-jira-plugin</artifactId>
- <version>${project.version}</version> </artifactItem>
- -->
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-jmx-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-mysql-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-netservices-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-oracle-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-perftest-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
<artifactId>rhq-platform-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
- <artifactId>rhq-postfix-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-postgres-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-samba-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-script-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-snmptrapd-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-sshd-plugin</artifactId>
+ <artifactId>rhq-agent-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
- <artifactId>rhq-sudoers-plugin</artifactId>
+ <artifactId>rhq-jmx-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-virt-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
- <artifactItem>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-kickstart-plugin</artifactId>
- <version>${project.version}</version>
- </artifactItem>
-
+ <!-- NOTE: The rest of the plugins are copied by enabled-by-default profiles defined below. -->
</artifactItems>
<outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
</configuration>
@@ -432,6 +296,308 @@
<profiles>
+ <profile>
+ <id>jboss-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>copy-jboss-plugins</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-augeas-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-apache-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-tomcat-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-as-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-hibernate-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-rhq-server-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-cache-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-as-5-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.jboss.on</groupId>
+ <artifactId>jopr-jboss-cache-v3-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>linux-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>copy-linux-plugins</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-augeas-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-cron-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-script-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-script2-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-grub-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-hosts-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-cobbler-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-sudoers-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-netservices-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-samba-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-postfix-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-aliases-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-sshd-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-virt-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-kickstart-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+
+ <profile>
+ <id>misc-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>copy-misc-plugins</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-hudson-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-iis-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-database-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-postgres-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-mysql-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-oracle-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-snmptrapd-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-twitter-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-filetemplate-bundle-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${earDirectory}/rhq-downloads/rhq-plugins</outputDirectory>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+
<profile>
<id>dev</id>
@@ -516,3 +682,4 @@
</profiles>
</project>
+
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index db7d4be..55e0546 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -128,9 +128,7 @@
<module>hosts</module>
<module>cobbler</module>
<module>sudoers</module>
- <module>hudson</module>
<module>netservices</module>
- <module>perftest</module>
<module>samba</module>
<module>postfix</module>
<module>aliases</module>
commit dbe158bd428c5e37df9e0b63999e05ec7236bcd6
Merge: f7c20d1... 18f6f3f...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 16 15:53:29 2010 -0500
Merge commit 'origin/raw-config' into raw-config2master
commit f7c20d176a37b35095232feadc6e624efcffee92
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Tue Feb 16 15:47:51 2010 -0500
Added the ability for the JBoss CSP sync to introduce a patches repo.
diff --git a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
index 90a0d30..967fbcf 100644
--- a/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
+++ b/modules/enterprise/server/plugins/jboss-software/src/main/java/org/rhq/enterprise/server/plugins/jboss/software/JBossSoftwareContentSourceAdapter.java
@@ -44,6 +44,9 @@ import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
import org.rhq.enterprise.server.plugin.pc.content.ContentProviderPackageDetails;
import org.rhq.enterprise.server.plugin.pc.content.PackageSource;
import org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport;
+import org.rhq.enterprise.server.plugin.pc.content.RepoDetails;
+import org.rhq.enterprise.server.plugin.pc.content.RepoImportReport;
+import org.rhq.enterprise.server.plugin.pc.content.RepoSource;
import org.rhq.enterprise.server.plugin.pc.content.SyncException;
import org.rhq.enterprise.server.plugin.pc.content.SyncProgressWeight;
@@ -52,7 +55,7 @@ import org.rhq.enterprise.server.plugin.pc.content.SyncProgressWeight;
*
* @author Jason Dobies
*/
-public class JBossSoftwareContentSourceAdapter implements ContentProvider, PackageSource {
+public class JBossSoftwareContentSourceAdapter implements ContentProvider, PackageSource, RepoSource {
// Connection properties, read from the user specified values specified at content source creation time
private String url;
@@ -162,6 +165,15 @@ public class JBossSoftwareContentSourceAdapter implements ContentProvider, Packa
return stream;
}
+ public RepoImportReport importRepos() throws Exception {
+ RepoDetails repo = new RepoDetails("JBoss Patches");
+
+ RepoImportReport report = new RepoImportReport();
+ report.addRepo(repo);
+
+ return report;
+ }
+
public String toString() {
return "JBossSoftwareContentSourceAdapter[url=" + this.url + ", username=" + this.username + "]";
}
commit 18f6f3f5080f6ddb85167c5cbbf781584958bdcf
Merge: 1e9fe18... d577cbd...
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 16 14:47:14 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 1e9fe18ed762b986f9a006f216fe84509054fbc5
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 16 14:46:35 2010 -0500
Modifying update method to call the correct update method in ConfigurationManagerBean
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 6ab5de1..fb500b7 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -150,8 +150,16 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
try {
- AbstractResourceConfigurationUpdate updateRequest = configurationMgr.updateStructuredOrRawConfiguration(
- loggedInUser.getSubject(), resourceId, resourceConfiguration, isStructuredMode());
+ AbstractResourceConfigurationUpdate updateRequest;
+
+ if (isStructuredAndRawSupported()) {
+ updateRequest = configurationMgr.updateStructuredOrRawConfiguration(loggedInUser.getSubject(),
+ resourceId, resourceConfiguration, isStructuredMode());
+ }
+ else {
+ updateRequest = configurationMgr.updateResourceConfiguration(loggedInUser.getSubject(),
+ resourceId, resourceConfiguration);
+ }
clearErrors();
commit ae5a157611db3c5439d0cabc847e29c0e00c2c7e
Merge: 64d83b8... 0e6f01c...
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Feb 16 11:48:05 2010 -0500
Merge branch 'master' into linux-config
commit d577cbd778f542b9f615f959eab0907d4b555df4
Merge: ff1f710... 740ba4b...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 16 11:41:26 2010 -0500
Merge commit 'origin/raw-config' into raw-config2master
commit ff1f710f7937264eaec19dcbcf875b28c956439e
Merge: 5bb2553... 0e6f01c...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 16 11:20:23 2010 -0500
Merged master into raw-config
diff --cc .classpath
index 980e44a,e9a098f..660d74d
--- a/.classpath
+++ b/.classpath
@@@ -1,7 -1,7 +1,8 @@@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/nss/src/main/java"/>
+ <classpathentry kind="src" path="etc/modules/base-perspective-war/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/>
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 32b38c8,f6d9da8..ebaaa56
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@@ -433,8 -437,18 +437,21 @@@ public interface ResourceManagerLocal
PageList<Resource> findChildResources(Subject subject, int resourceId, PageControl pageControl);
+ Resource getPlaformOfResource(Subject subject, int resourceId);
+
+
Resource getParentResource(Subject subject, int resourceId);
+
+ /**
+ * Given a list of results, this method produces
+ *
+ * @param <T> the type of the result elements
+ * @param results the results to disambiguate
+ * @param alwayIncludeParent if true, the parent disambiguation will always be included in the result
+ * even if the results wouldn't have to be disambiguated using parents.
+ * @param resourceIdExtractor an object able to extract resource id from an instance of type parameter.
+ * @return the disambiguation result or null on error
+ */
+ <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwayIncludeParent,
+ IntExtractor<? super T> resourceIdExtractor);
}
commit 740ba4b1a0a1ec43ddf3a5820d2e8789a1b89234
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 16 11:03:21 2010 -0500
Removing call to ExistingResourceConfigurationUIBean as it is longer used.
ExistingResourceConfigurationUIBean was replaced by the seam components ResourceConfigurationViewer
and ResourceConfigurationEditor. The call to ExistingResourceConfigurationUIBean was resulting in
an exception getting thrown and making it appear as if rollback failed.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ListConfigurationUpdateUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ListConfigurationUpdateUIBean.java
index b3839fc..8616b6b 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ListConfigurationUpdateUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/history/ListConfigurationUpdateUIBean.java
@@ -71,12 +71,6 @@ public class ListConfigurationUpdateUIBean extends PagedDataTableUIBean {
manager.rollbackResourceConfiguration(subject, resource.getId(), Integer.parseInt(rollbackTo));
- // We've just updated the current Configuration, so clear the current Configuration that is cached in the
- // Session, so the config view/edit pages will not display a stale version of the Configuration.
- ExistingResourceConfigurationUIBean configUIBean = FacesContextUtility
- .getManagedBean(ExistingResourceConfigurationUIBean.class);
- configUIBean.clearConfiguration();
-
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Rolled back resource configuration to version "
+ rollbackTo);
} catch (Exception e) {
commit 996e75be15bcf064d87e5ac41832cf8ac621830a
Author: Justin Harris <jharris(a)redhat.com>
Date: Mon Feb 15 20:44:57 2010 -0500
Adding in a rough pass at the new Alert Conditions page.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
new file mode 100644
index 0000000..9ac7e65
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionUIBean.java
@@ -0,0 +1,285 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.core.domain.alert.AlertDampening;
+import org.rhq.core.domain.alert.AlertDampening.TimeUnits;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.BooleanExpression;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementSchedule;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.operation.OperationRequestStatus;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
+import org.rhq.enterprise.server.legacy.measurement.MeasurementConstants;
+import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
+import org.rhq.enterprise.server.measurement.util.MeasurementFormatter;
+import org.rhq.enterprise.server.operation.OperationManagerLocal;
+
+(a)Scope(ScopeType.PAGE)
+@Name("alertConditionUIBean")
+public class AlertConditionUIBean {
+
+ @In("#{webUser.subject}")
+ private Subject subject;
+
+ @In
+ private ResourceType resourceType;
+
+ @In
+ private AlertDefinition alertDefinition;
+
+ @In
+ private AlertDefinitionManagerLocal alertDefinitionManager;
+
+ @In
+ private MeasurementDefinitionManagerLocal measurementDefinitionManager;
+
+ @In
+ private OperationManagerLocal operationManager;
+
+ @In
+ private MeasurementScheduleManagerLocal measurementScheduleManager;
+
+ @In
+ private Map<String, String> messages;
+
+ private Map<String, String> conditionExpressions;
+ private Map<String, String> availabilities;
+ private Map<String, String> severities;
+ private Map<String, String> operationStatuses;
+ private Map<String, String> comparators;
+ private Map<String, String> baselines;
+
+ private Map<String, Integer> measurements;
+ private Map<String, Integer> traits;
+ private Map<String, String> operations;
+ private Map<String, Integer> existingAlerts;
+ private Map<String, String> dampeningCategories;
+ private Map<String, String> timeUnits;
+
+
+ public Map<String, String> getConditionExpressions() {
+ return conditionExpressions;
+ }
+
+ public Map<String, String> getAvailabilities() {
+ return availabilities;
+ }
+
+ public Map<String, String> getSeverities() {
+ return severities;
+ }
+
+ public Map<String, String> getOperationStatuses() {
+ return operationStatuses;
+ }
+
+ public Map<String, String> getComparators() {
+ return comparators;
+ }
+
+ public Map<String, String> getBaselines() {
+ return baselines;
+ }
+
+ public Map<String, String> getOperations() {
+ return operations;
+ }
+
+ public Map<String, Integer> getMeasurements() {
+ return measurements;
+ }
+
+ public Map<String, Integer> getTraits() {
+ return traits;
+ }
+
+ public Map<String, Integer> getExistingAlerts() {
+ return existingAlerts;
+ }
+
+ public Map<String, String> getDampeningCategories() {
+ return dampeningCategories;
+ }
+
+ public Map<String, String> getTimeUnits() {
+ return timeUnits;
+ }
+
+ @Create
+ public void init() {
+ this.conditionExpressions = createBooleanMap();
+ this.availabilities = createMap(AvailabilityType.class, "Goes ");
+ this.severities = createMap(EventSeverity.class);
+ this.operationStatuses = createMap(OperationRequestStatus.class);
+ this.comparators = createComparatorMap();
+ this.baselines = createBaselines();
+
+ this.measurements = lookupMeasurements(DataType.MEASUREMENT);
+ this.traits = lookupMeasurements(DataType.TRAIT);
+ this.operations = lookupOperations();
+ this.existingAlerts = lookupExistingAlerts();
+ this.dampeningCategories = createDampeningMap();
+ this.timeUnits = createTimeUnits();
+ }
+
+ private Map<String, String> createBooleanMap() {
+ Map<String, String> booleanMap = new HashMap<String, String>();
+
+ booleanMap.put(BooleanExpression.ALL.name(), BooleanExpression.ALL.name());
+ booleanMap.put(BooleanExpression.ANY.name(), BooleanExpression.ANY.name());
+
+ return booleanMap;
+ }
+
+ private Map<String, Integer> lookupExistingAlerts() {
+ Map<String, Integer> alertsMap = new HashMap<String, Integer>();
+
+ PageList<AlertDefinition> alerts = alertDefinitionManager.findAlertDefinitions(subject,
+ this.alertDefinition.getResource().getId(), PageControl.getUnlimitedInstance());
+
+ for (AlertDefinition alert : alerts) {
+ alertsMap.put(alert.getName(), alert.getId());
+ }
+
+ return alertsMap;
+ }
+
+ private Map<String, String> createTimeUnits() {
+ Map<String, String> timeUnitMap = new HashMap<String, String>();
+
+ for (TimeUnits unit : TimeUnits.values()) {
+ String unitName = unit.name();
+ timeUnitMap.put(unitName.toLowerCase(), unitName);
+ }
+
+ return timeUnitMap;
+ }
+
+ private Map<String, String> createDampeningMap() {
+ Map<String, String> dampeningMap = new HashMap<String, String>();
+
+ dampeningMap.put("Every Time", "NONE");
+ dampeningMap.put("Every X Times Consecutively", AlertDampening.Category.CONSECUTIVE_COUNT.name());
+ dampeningMap.put("Every X Out of Y Evaluations", AlertDampening.Category.PARTIAL_COUNT.name());
+ dampeningMap.put("Every X Times Within a Time Duration ", AlertDampening.Category.DURATION_COUNT.name());
+
+ return dampeningMap;
+ }
+
+ private Map<String, String> createComparatorMap() {
+ Map<String, String> comparatorMap = new HashMap<String, String>();
+
+ comparatorMap.put(messages.get("alert.config.props.CB.Content.Comparator.>"), ">");
+ comparatorMap.put(messages.get("alert.config.props.CB.Content.Comparator.<"), "<");
+ comparatorMap.put(messages.get("alert.config.props.CB.Content.Comparator.="), "=");
+
+ return comparatorMap;
+ }
+
+ private Map<String, String> createBaselines() {
+ Map<String, String> baselineMap = new HashMap<String, String>();
+
+ List<MeasurementDefinition> definitions = this.measurementDefinitionManager.findMeasurementDefinitionsByResourceType(subject,
+ resourceType.getId(), DataType.MEASUREMENT, null);
+
+ int[] definitionIds = new int[definitions.size()];
+
+ for (int i = 0; i < definitionIds.length; i++) {
+ definitionIds[i] = definitions.get(i).getId();
+ }
+
+ List<MeasurementSchedule> schedules = measurementScheduleManager.findSchedulesByResourceIdAndDefinitionIds(subject,
+ this.alertDefinition.getResource().getId(), definitionIds);
+
+ for (MeasurementSchedule schedule : schedules) {
+ baselineMap.put(getLabel(MeasurementConstants.BASELINE_OPT_MIN, schedule), MeasurementConstants.BASELINE_OPT_MIN);
+ baselineMap.put(getLabel(MeasurementConstants.BASELINE_OPT_MEAN, schedule), MeasurementConstants.BASELINE_OPT_MEAN);
+ baselineMap.put(getLabel(MeasurementConstants.BASELINE_OPT_MAX, schedule), MeasurementConstants.BASELINE_OPT_MAX);
+ }
+
+ return baselineMap;
+
+ }
+
+ private String getLabel(String measurementConstant, MeasurementSchedule schedule) {
+ return MeasurementFormatter.getBaselineText(measurementConstant, schedule);
+ }
+
+ private Map<String, Integer> lookupMeasurements(DataType type) {
+ Map<String, Integer> measurementMap = new HashMap<String, Integer>();
+
+ List<MeasurementDefinition> definitions = this.measurementDefinitionManager.findMeasurementDefinitionsByResourceType(subject,
+ resourceType.getId(), type, null);
+
+ for (MeasurementDefinition definition : definitions) {
+ measurementMap.put(definition.getDisplayName(), definition.getId());
+ }
+
+ return measurementMap;
+ }
+
+ private Map<String, String> lookupOperations() {
+ Map<String, String> operationMap = new HashMap<String, String>();
+
+ List<OperationDefinition> operationDefinitions = operationManager.findSupportedResourceTypeOperations(subject,
+ resourceType.getId(), false);
+
+ for (OperationDefinition operationDefinition : operationDefinitions) {
+ operationMap.put(operationDefinition.getDisplayName(), operationDefinition.getName());
+ }
+
+ return operationMap;
+ }
+
+ private <T extends Enum> Map<String, String> createMap(Class<T> enumType) {
+ return createMap(enumType, "");
+ }
+
+ private <T extends Enum> Map<String, String> createMap(Class<T> enumType, String prefix) {
+ Set<T> enumSet = EnumSet.allOf(enumType);
+ Map<String, String> enumMap = new HashMap<String, String>(enumSet.size());
+
+ for (T enumItem : enumSet) {
+ enumMap.put(prefix + enumItem.name(), enumItem.toString());
+ }
+
+ return enumMap;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
new file mode 100644
index 0000000..00ea5eb
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertConditionsUIBean.java
@@ -0,0 +1,265 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.international.StatusMessage.Severity;
+import org.jboss.seam.log.Log;
+import org.rhq.core.domain.alert.AlertCondition;
+import org.rhq.core.domain.alert.AlertConditionCategory;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.gui.alert.converter.MetricAbsoluteConverter;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
+
+(a)Scope(ScopeType.PAGE)
+@Name("alertConditionsUIBean")
+public class AlertConditionsUIBean {
+
+ private final static String SUCCESS_OUTCOME = "success";
+
+ @Logger
+ private Log log;
+
+ @In
+ private FacesMessages facesMessages;
+
+ @In("#{webUser.subject}")
+ private Subject subject;
+
+ @In
+ private ResourceType resourceType;
+
+ @In
+ private AlertDefinitionManagerLocal alertDefinitionManager;
+
+ @In
+ private MeasurementDefinitionManagerLocal measurementDefinitionManager;
+
+ @In
+ private ConfigurationManagerLocal configurationManager;
+
+ @In
+ private AlertDefinition alertDefinition;
+
+ @In
+ private AlertDescriber alertDescriber;
+
+ private MetricAbsoluteConverter metricAbsoluteConverter = new MetricAbsoluteConverter();
+ private Map<AlertConditionCategory, String> categories;
+ private List<ConditionDescription> conditionDescriptions;
+ private AlertCondition currentCondition;
+
+ private Integer measurementDefinitionId = 0;
+ private Double threshold;
+
+ public String getMeasurementDefinitionId() {
+ return measurementDefinitionId.toString();
+ }
+
+ public void setMeasurementDefinitionId(String measurementDefinitionId) {
+ this.measurementDefinitionId = Integer.parseInt(measurementDefinitionId);
+ }
+
+ public String getThreshold() {
+ if (threshold != null) {
+ return threshold.toString();
+ }
+
+ return null;
+ }
+
+ public void setThreshold(String threshold) {
+ this.threshold = Double.parseDouble(threshold);
+ }
+
+ public List<ConditionDescription> getConditionDescriptions() {
+ return conditionDescriptions;
+ }
+
+ public Map<AlertConditionCategory, String> getCategories() {
+ return categories;
+ }
+
+ public AlertCondition getCurrentCondition() {
+ return currentCondition;
+ }
+
+ public void setCurrentCondition(AlertCondition currentCondition) {
+ this.currentCondition = currentCondition;
+
+ if (shouldSetMeasurementDefinition()) {
+ MeasurementDefinition measurement = this.currentCondition.getMeasurementDefinition();
+
+ if (measurement != null) {
+ setMeasurementDefinitionId(Integer.toString(measurement.getId()));
+ this.threshold = metricAbsoluteConverter.getForDisplay(this.currentCondition.getThreshold(), measurement);
+ }
+ }
+ }
+
+ @Create
+ public void init() {
+ this.conditionDescriptions = createDescriptions();
+ this.categories = createCategoryMap();
+ }
+
+ private List<ConditionDescription> createDescriptions() {
+ Set<AlertCondition> conditions = alertDefinition.getConditions();
+ List<ConditionDescription> descriptions = new ArrayList<ConditionDescription>(conditions.size());
+
+ for (AlertCondition condition : conditions) {
+ descriptions.add(new ConditionDescription(condition));
+ }
+
+ return descriptions;
+ }
+
+ public void addCondition() {
+ setCurrentCondition(new AlertCondition());
+ }
+
+ public String removeCondition() {
+ this.conditionDescriptions.remove(findCurrentDescription());
+ setCurrentCondition(null);
+
+ // persist to DB
+ return saveConditions();
+ }
+
+ public String saveConditions() {
+ if (shouldSetMeasurementDefinition()) {
+ MeasurementDefinition measurementDefinition = this.measurementDefinitionManager.getMeasurementDefinition(subject, this.measurementDefinitionId);
+ currentCondition.setMeasurementDefinition(measurementDefinition);
+ currentCondition.setName(measurementDefinition.getDisplayName());
+
+ if (measurementDefinition != null && this.threshold != null) {
+ currentCondition.setThreshold(metricAbsoluteConverter.getForThreshold(threshold, measurementDefinition));
+ }
+ }
+
+ Set<AlertCondition> conditions = findConditions();
+
+ // in case of a newly added condition
+ if (this.currentCondition != null && !conditions.contains(this.currentCondition)) {
+ conditions.add(this.currentCondition);
+ }
+
+ alertDefinition.setConditions(conditions);
+
+ return saveAlertDefinition();
+ }
+
+ public String saveAlertDefinition() {
+ try {
+ alertDefinitionManager.updateAlertDefinition(subject, alertDefinition.getId(), alertDefinition, true);
+ } catch(Exception e) {
+ this.facesMessages.add(Severity.ERROR, "There was an error saving the alert conditions.");
+ this.log.error("Error persisting AlertCondition on AlertDefinition: " + alertDefinition.getName(), e);
+
+ return null;
+ }
+
+ return SUCCESS_OUTCOME;
+ }
+
+ private boolean shouldSetMeasurementDefinition() {
+ if (currentCondition != null) {
+ AlertConditionCategory category = currentCondition.getCategory();
+
+ return category == AlertConditionCategory.TRAIT ||
+ category == AlertConditionCategory.CHANGE ||
+ category == AlertConditionCategory.THRESHOLD ||
+ category == AlertConditionCategory.BASELINE;
+ }
+
+ return false;
+ }
+
+ private ConditionDescription findCurrentDescription() {
+ for (ConditionDescription description : conditionDescriptions) {
+ if (description.condition == this.currentCondition) {
+ return description;
+ }
+ }
+
+ return null;
+ }
+
+ private Set<AlertCondition> findConditions() {
+ Set<AlertCondition> conditionSet = new HashSet<AlertCondition>(conditionDescriptions.size());
+
+ for (ConditionDescription description : conditionDescriptions) {
+ conditionSet.add(description.condition);
+ }
+
+ return conditionSet;
+ }
+
+ private Map<AlertConditionCategory, String> createCategoryMap() {
+ Map<AlertConditionCategory, String> categoryMap = new HashMap<AlertConditionCategory, String>();
+
+ for (AlertConditionCategory category : AlertConditionCategory.values()) {
+ categoryMap.put(category, category.getName());
+ }
+
+ categoryMap.remove(AlertConditionCategory.ALERT);
+
+ if (configurationManager.getResourceConfigurationDefinitionForResourceType(subject, resourceType.getId()) == null) {
+ categoryMap.remove(AlertConditionCategory.RESOURCE_CONFIG);
+ }
+
+ return categoryMap;
+ }
+
+ public class ConditionDescription {
+ private AlertCondition condition;
+ private String description;
+
+ public ConditionDescription(AlertCondition condition) {
+ this.condition = condition;
+ this.description = alertDescriber.describeCondition(condition);
+ }
+
+ public AlertCondition getCondition() {
+ return condition;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationConverter.java
deleted file mode 100644
index 2753f43..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationConverter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.enterprise.gui.alert;
-
-import java.util.List;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import org.rhq.core.domain.alert.notification.AlertNotification;
-
-public class AlertNotificationConverter implements Converter {
-
- private List<AlertNotification> alertNotifications;
-
- public void setAlertNotifications(List<AlertNotification> alertNotifications) {
- this.alertNotifications = alertNotifications;
- }
-
- public Object getAsObject(FacesContext context, UIComponent component, String value) {
- int notificationId = Integer.parseInt(value);
-
- for (AlertNotification notification : alertNotifications) {
- if (notificationId == notification.getId()) {
- return notification;
- }
- }
-
- return null;
- }
-
- public String getAsString(FacesContext context, UIComponent component, Object notificationObject) {
- AlertNotification notification = (AlertNotification) notificationObject;
-
- return Integer.toString(notification.getId());
- }
-
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
index b7ef9d0..dea2b87 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.alert;
+import org.rhq.enterprise.gui.alert.converter.AlertNotificationConverter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java
new file mode 100644
index 0000000..f173d5f
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ResourceTypeComponent.java
@@ -0,0 +1,46 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.alert;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+
+@AutoCreate
+(a)Scope(ScopeType.EVENT)
+@Name("resourceType")
+public class ResourceTypeComponent {
+
+ @In
+ private AlertDefinition alertDefinition;
+
+ @Unwrap
+ public ResourceType lookupResourceType() {
+ if (this.alertDefinition.getResource() != null) {
+ return this.alertDefinition.getResource().getResourceType();
+ }
+
+ return this.alertDefinition.getResourceGroup().getResourceType();
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/AlertNotificationConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/AlertNotificationConverter.java
new file mode 100644
index 0000000..7b01990
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/AlertNotificationConverter.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.alert.converter;
+
+import java.util.List;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import org.rhq.core.domain.alert.notification.AlertNotification;
+
+public class AlertNotificationConverter implements Converter {
+
+ private List<AlertNotification> alertNotifications;
+
+ public void setAlertNotifications(List<AlertNotification> alertNotifications) {
+ this.alertNotifications = alertNotifications;
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ int notificationId = Integer.parseInt(value);
+
+ for (AlertNotification notification : alertNotifications) {
+ if (notificationId == notification.getId()) {
+ return notification;
+ }
+ }
+
+ return null;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object notificationObject) {
+ AlertNotification notification = (AlertNotification) notificationObject;
+
+ return Integer.toString(notification.getId());
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricAbsoluteConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricAbsoluteConverter.java
new file mode 100644
index 0000000..59d9ffc
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricAbsoluteConverter.java
@@ -0,0 +1,50 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.alert.converter;
+
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+
+public class MetricAbsoluteConverter {
+
+ private final static Double DEFAULT_VALUE = 0.0;
+
+ public Double getForDisplay(Double threshold, MeasurementDefinition measurementDefinition) {
+ if (threshold == null) {
+ threshold = DEFAULT_VALUE;
+ }
+
+ MeasurementUnits units = measurementDefinition.getUnits();
+ return MeasurementUnits.scaleUp(threshold, units);
+ }
+
+ public Double getForThreshold(Double displayValue, MeasurementDefinition measurementDefinition) {
+ if (displayValue == null) {
+ displayValue = DEFAULT_VALUE;
+ }
+
+ MeasurementUnits units = measurementDefinition.getUnits();
+ return MeasurementUnits.scaleDown(displayValue, units);
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
new file mode 100644
index 0000000..eec5333
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/converter/MetricPercentConverter.java
@@ -0,0 +1,53 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.alert.converter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.faces.Converter;
+import org.rhq.core.domain.measurement.MeasurementUnits;
+import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
+import org.rhq.core.domain.measurement.util.MeasurementConverter;
+
+@Converter
+(a)Scope(ScopeType.APPLICATION)
+@Name("metricPercentConverter")
+public class MetricPercentConverter implements javax.faces.convert.Converter {
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ MeasurementNumericValueAndUnits percentage = MeasurementConverter.parse(value, MeasurementUnits.PERCENTAGE);
+
+ return percentage.getValue();
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ Double percentage = (Double) value;
+ percentage = MeasurementUnits.scaleUp(percentage, MeasurementUnits.PERCENTAGE);
+ return percentage.toString();
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
index d8f2b70..bcf5d25 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/description/ControlDescriber.java
@@ -42,10 +42,10 @@ public class ControlDescriber extends AlertConditionDescriber {
if (definition != null) {
builder.append(definition.getDisplayName());
+ } else {
+ builder.append(condition.getName());
}
-
- builder.append(' ');
- builder.append(definition.getDisplayName());
+
builder.append(' ');
builder.append(condition.getOption());
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
index 1880730..c62c163 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
@@ -118,5 +118,17 @@
</navigation-case>
</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/rhq/resource/alert/listConditions.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/resource/alert/listConditions.xhtml?ad=#{alertDefinition.id}</to-view-id>
+
+ <redirect />
+ </navigation-case>
+
+ </navigation-rule>
</faces-config>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
new file mode 100644
index 0000000..e4e938d
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listConditions.xhtml
@@ -0,0 +1,352 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:composition template="/rhq/layout/main.xhtml">
+ <ui:param name="pageTitle" value="Alert Conditions for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'"/>
+
+ <ui:define name="metaHeaders">
+
+ </ui:define>
+
+ <ui:define name="breadcrumbs">
+ <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}"/>
+ <h:outputText>Alert Definitions</h:outputText>
+ </h:outputLink>
+ <h:outputText value=">" />
+ <h:outputLink value="viewAlert.xhtml">
+ <f:param name="ad" value="#{param.ad}" />
+ <h:outputText value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'" />
+ </h:outputLink>
+ </ui:define>
+
+ <ui:define name="body">
+ <a4j:form>
+ <rich:panel id="conditionsPanel">
+ <f:facet name="header">
+ <h:outputText value="Alert Conditions"/>
+ </f:facet>
+
+ <rich:panel id="conditionExpression">
+ <h:outputText value="#{messages['alert.config.props.CB.ExpressionDetails.1']} " />
+ <h:selectOneMenu value="#{alertDefinition.conditionExpression}">
+ <f:selectItems value="#{alertConditionUIBean.conditionExpressions}" />
+ </h:selectOneMenu>
+ <h:outputText value=" #{messages['alert.config.props.CB.ExpressionDetails.2']}" />
+ </rich:panel>
+
+ <rich:panel id="conditionSet">
+ <f:facet name="header">
+ <h:outputText value="Condition Set"/>
+ </f:facet>
+
+ <h:messages />
+
+ <rich:dataTable id="categoryTable" value="#{alertConditionsUIBean.conditionDescriptions}" var="conditionDescription">
+ <rich:column>
+ <h:outputText value="#{conditionDescription.description}" />
+ </rich:column>
+
+ <rich:column>
+ <a4j:commandButton id="editButton"
+ value="Edit"
+ styleClass="buttonmed"
+ reRender="categoryOptionsPanel">
+
+ <f:setPropertyActionListener value="#{conditionDescription.condition}" target="#{alertConditionsUIBean.currentCondition}" />
+ <rich:componentControl for="categoryModalPanel" attachTo="editButton" operation="show" event="onclick" />
+ </a4j:commandButton>
+ </rich:column>
+
+ <rich:column>
+ <a4j:commandButton id="removeButton"
+ value="Delete"
+ styleClass="buttonmed"
+ action="#{alertConditionsUIBean.removeCondition}"
+ reRender="categoryTable">
+
+ <f:setPropertyActionListener value="#{conditionDescription.condition}" target="#{alertConditionsUIBean.currentCondition}" />
+ </a4j:commandButton>
+ </rich:column>
+ </rich:dataTable>
+
+ <br />
+ <a4j:commandButton id="addConditionButton"
+ value="Add a new Condition"
+ action="#{alertConditionsUIBean.addCondition}"
+ styleClass="buttonmed">
+ <rich:componentControl for="categoryModalPanel" attachTo="addConditionButton" operation="show" event="onclick" />
+ <a4j:support event="onclick" reRender="categoryOptionsPanel" />
+ </a4j:commandButton>
+
+ </rich:panel>
+ </rich:panel>
+
+ <rich:panel id="recoveryPanel">
+ <f:facet name="header">
+ <h:outputText value="Alert Recovery"/>
+ </f:facet>
+
+ <h:outputText value="#{messages['alert.config.props.CB.Recovery']} " />
+ <h:outputText value="#{messages['alert.config.props.CB.RecoveryFor']}" />
+
+ <h:selectOneMenu value="#{alertDefinition.recoveryId}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" itemValue="0" />
+ <f:selectItems value="#{alertConditionUIBean.existingAlerts}" />
+ </h:selectOneMenu>
+ <br />
+
+ <h:selectBooleanCheckbox id="willRecoverCheckbox" value="#{alertDefinition.willRecover}" />
+ <h:outputLabel for="willRecoverCheckbox" value="#{messages['alert.config.props.CB.Content.UntilRecovered']}" />
+
+ <br />
+ <br />
+
+ </rich:panel>
+
+ <rich:panel id="dampeningPanel">
+ <f:facet name="header">
+ <h:outputText value="Alert Dampening"/>
+ </f:facet>
+
+ <h:selectOneMenu value="#{alertDefinition.alertDampening.category}">
+ <f:selectItems value="#{alertConditionUIBean.dampeningCategories}" />
+ <a4j:support event="onchange" reRender="dampeningOptions" status="dampeningLoadStatus" />
+ </h:selectOneMenu>
+
+ <br />
+ <br />
+
+ <a4j:status id="dampeningLoadStatus" forceId="true">
+ <f:facet name="start">
+ <strong>
+ <h:outputText value="Loading Dampening Category..." />
+ </strong>
+ <br /><br />
+ <h:graphicImage value="/images/ajax-loader.gif" />
+ </f:facet>
+
+ <f:facet name="stop">
+ <s:div id="dampeningOptions">
+ <ui:fragment rendered="#{alertDefinition.alertDampening.category == 'NONE'}">
+ <h:outputText value="#{messages['alert.config.props.CB.Content.DampenNone']}" />
+ </ui:fragment>
+
+ <ui:fragment rendered="#{alertDefinition.alertDampening.category == 'CONSECUTIVE_COUNT'}">
+ <h:outputText value="#{messages['alert.config.props.CB.Content.DampenConsecutiveCount.1']} " />
+ <h:inputText value="#{alertDefinition.alertDampening.value}"
+ required="true"
+ maxlength="5"/>
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.DampenConsecutiveCount.2']}" />
+ </ui:fragment>
+
+ <ui:fragment rendered="#{alertDefinition.alertDampening.category == 'PARTIAL_COUNT'}">
+ <h:outputText value="#{messages['alert.config.props.CB.Content.DampenPartialCount.1']} " />
+ <h:inputText value="#{alertDefinition.alertDampening.value}"
+ required="true"
+ maxlength="5"/>
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.2']} " />
+ <h:inputText value="#{alertDefinition.alertDampening.period}" />
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.DampenPartialCount.3']}" />
+ </ui:fragment>
+
+ <ui:fragment rendered="#{alertDefinition.alertDampening.category == 'DURATION_COUNT'}">
+ <h:outputText value="#{messages['alert.config.props.CB.Content.DampenDurationCount.1']} " />
+ <h:inputText value="#{alertDefinition.alertDampening.value}" />
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.DampenDurationCount.2']} " />
+ <h:inputText value="#{alertDefinition.alertDampening.period}" />
+
+ <h:selectOneMenu value="#{alertDefinition.alertDampening.periodUnits}">
+ <f:selectItems value="#{alertConditionUIBean.timeUnits}" />
+ </h:selectOneMenu>
+ </ui:fragment>
+ </s:div>
+ </f:facet>
+ </a4j:status>
+
+ </rich:panel>
+ <h:commandButton id="saveButton"
+ value="OK"
+ action="#{alertConditionsUIBean.saveAlertDefinition}"
+ styleClass="buttonmed" />
+ </a4j:form>
+
+ <rich:modalPanel id="categoryModalPanel" moveable="false" autosized="true" width="400">
+
+ <rich:panel id="categoryOptionsPanel">
+ <h:panelGrid columns="1" cellpadding="5" width="%100">
+ <h:form id="categoryForm">
+ <h:selectOneMenu value="#{alertConditionsUIBean.currentCondition.category}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <s:selectItems value="#{alertConditionsUIBean.categories}" />
+ <a4j:support event="onchange" reRender="categoryOptions" status="categoryLoadStatus" />
+ </h:selectOneMenu>
+ </h:form>
+
+
+ <a4j:status id="categoryLoadStatus">
+ <f:facet name="start">
+ <strong>
+ <h:outputText value="Loading Condition..." />
+ </strong>
+ <br /><br />
+ <h:graphicImage value="/images/ajax-loader.gif" />
+ </f:facet>
+
+ <f:facet name="stop">
+ <h:form>
+ <rich:panel id="categoryOptions" style="width: %100;">
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'CONTROL'}">
+ <h:outputLabel for="operationSelection" value="#{messages['alert.config.props.CB.Content.ControlAction']} " />
+
+ <h:selectOneMenu id="operationSelection" value="#{alertConditionsUIBean.currentCondition.name}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.operations}" />
+ </h:selectOneMenu>
+
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.Comparator.=']} " />
+
+ <h:selectOneMenu id="operationStatusSelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.operationStatuses}" />
+ </h:selectOneMenu>
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'AVAILABILITY'}">
+ <h:outputLabel for="availabilitySelection" value="#{messages['alert.config.props.CB.Content.Availability']} " />
+
+ <h:selectOneMenu id="availabilitySelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.availabilities}" />
+ </h:selectOneMenu>
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'CHANGE'}">
+ <h:outputLabel for="metricChangeSelection" value="#{messages['alert.config.props.CB.Content.Metric']} " />
+
+ <h:selectOneMenu id="metricChangeSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.measurements}" />
+ </h:selectOneMenu>
+
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.Changes']}" />
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'THRESHOLD'}">
+ <h:outputLabel for="metricThresholdSelection" value="#{messages['alert.config.props.CB.Content.Metric']}" />
+
+ <h:selectOneMenu id="metricThresholdSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.measurements}" />
+ </h:selectOneMenu>
+
+ <h:outputText value="#{messages['alert.config.props.CB.Content.Is']}" />
+
+ <h:selectOneMenu id="metricThresholdComparatorSelection" value="#{alertConditionsUIBean.currentCondition.comparator}">
+ <f:selectItems value="#{alertConditionUIBean.comparators}" />
+ </h:selectOneMenu>
+ <br />
+ <br />
+
+ <h:inputText id="metricThresholdAbsolute" value="#{alertConditionsUIBean.threshold}" />
+ <h:outputLabel for="metricThresholdAbsolute" value="#{messages['alert.config.props.CB.Content.AbsoluteValue']}" />
+ </ui:fragment>
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'BASELINE'}">
+ <h:outputLabel for="metricBaselineSelection" value="#{messages['alert.config.props.CB.Content.Metric']} " />
+
+ <h:selectOneMenu id="metricBaselineSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.measurements}" />
+ </h:selectOneMenu>
+
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.Is']} " />
+
+ <h:selectOneMenu id="metricBaselineComparatorSelection" value="#{alertConditionsUIBean.currentCondition.comparator}">
+ <f:selectItems value="#{alertConditionUIBean.comparators}" />
+ </h:selectOneMenu>
+ <br />
+ <br />
+
+ <h:inputText id="metricBaselinePercent" value="#{alertConditionsUIBean.currentCondition.threshold}" converter="#{metricPercentConverter}" />
+ <h:outputLabel for="metricBaselinePercent" value=" #{messages['alert.config.props.CB.Content.Percent']} " />
+
+ <h:selectOneMenu id="metricBaselineBaselineSelection" value="#{alertConditionsUIBean.currentCondition.option}">
+ <f:selectItems value="#{alertConditionUIBean.baselines}" />
+ </h:selectOneMenu>
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'EVENT'}">
+ <h:outputLabel for="eventSelection" value="#{messages['alert.config.props.CB.Content.EventSeverity']} " />
+
+ <h:selectOneMenu id="eventSelection" value="#{alertConditionsUIBean.currentCondition.name}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.severities}" />
+ </h:selectOneMenu>
+
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.Match']}" />
+ <h:inputText id="eventExpression" value="#{alertConditionsUIBean.currentCondition.option}" />
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'TRAIT'}">
+ <h:outputLabel for="traitSelection" value="#{messages['alert.config.props.CB.Content.Trait']} " />
+
+ <h:selectOneMenu id="traitSelection" value="#{alertConditionsUIBean.measurementDefinitionId}">
+ <f:selectItem itemLabel="#{messages['alert.dropdown.SelectOption']}" />
+ <f:selectItems value="#{alertConditionUIBean.traits}" />
+ </h:selectOneMenu>
+
+ <h:outputText value=" #{messages['alert.config.props.CB.Content.Changes']}" />
+ </ui:fragment>
+
+
+ <ui:fragment rendered="#{alertConditionsUIBean.currentCondition.category == 'RESOURCE_CONFIG'}">
+ <h:outputText value="#{messages['alert.config.props.CB.Content.ResourceConfiguration']} " />
+ <h:outputText value="#{messages['alert.config.props.CB.Content.Changes']}" />
+ </ui:fragment>
+
+ </rich:panel>
+
+ <h:commandButton id="categoryOptionOkButton"
+ value="OK"
+ action="#{alertConditionsUIBean.saveConditions}"
+ styleClass="buttonmed"
+ style="margin: 5px;">
+ </h:commandButton>
+
+ <h:outputLink id="conditionCancelLink" styleClass="buttonmed" value="#" style="float: right; margin: 5px;">
+ <h:outputText value="Cancel" />
+ <rich:componentControl for="categoryModalPanel" attachTo="conditionCancelLink" operation="hide" event="onclick" />
+ </h:outputLink>
+ </h:form>
+ </f:facet>
+ </a4j:status>
+
+ </h:panelGrid>
+
+ </rich:panel>
+ </rich:modalPanel>
+
+ </ui:define>
+ </ui:composition>
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 8a1f9d2..0309174 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -144,12 +144,9 @@
</h:panelGroup>
</h:panelGrid>
- <!-- Temp -->
<br /><br />
- <h:outputLink id="editConditionsLink" styleClass="buttonmed" value="/alerts/Config.do">
- <f:param name="mode" value="editConditions" />
+ <h:outputLink id="editConditionsLink" styleClass="buttonmed" value="listConditions.xhtml">
<f:param name="ad" value="#{param.ad}" />
- <f:param name="id" value="#{alertDefinition.resource.id}" />
<h:outputText value="Edit Alert Conditions" />
</h:outputLink>
commit 64d83b8807ac899eff77f5b77fa0557331ec7fa8
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Mon Feb 15 21:09:14 2010 +0100
IfModule support
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
index 547f648..0cf6e74 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryComponent.java
@@ -23,6 +23,7 @@
package org.rhq.plugins.apache;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -31,6 +32,8 @@ import org.rhq.augeas.node.AugeasNode;
import org.rhq.augeas.tree.AugeasTree;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
@@ -40,6 +43,7 @@ import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.plugins.apache.mapping.ApacheAugeasMapping;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
/**
* Component for configuring the <Directory> and underlying directives inside
@@ -52,12 +56,23 @@ public class ApacheDirectoryComponent implements ResourceComponent<ApacheVirtual
private final Log log = LogFactory.getLog(this.getClass());
public static final String DIRECTIVE_INDEX_PROP = "directiveIndex";
public static final String REGEXP_PROP = "regexp";
+ public static final String PARAMS_PROPERTY_NAME = "ifmoduleParams";
+ public static final String DIRECTORY_DIRECTIVE = "<Directory";
+ private List<String> position;
private ResourceContext<ApacheVirtualHostServiceComponent> resourceContext;
public void start(ResourceContext<ApacheVirtualHostServiceComponent> context) throws InvalidPluginConfigurationException, Exception {
resourceContext = context;
- }
+ String key = context.getResourceKey();
+ position = new ArrayList<String>();
+ String param = key.substring(0,key.indexOf("|"));
+ for (String pm :param.split(";")){
+ position.add(pm);
+ }
+
+ }
+
public void stop() {
}
@@ -130,8 +145,8 @@ public class ApacheDirectoryComponent implements ResourceComponent<ApacheVirtual
* @param virtualHost the node of the parent virtualHost (or root node of the augeas tree)
* @return
*/
- private AugeasNode getNode(AugeasNode virtualHost) {
- List<AugeasNode> directories = virtualHost.getChildByLabel("<Directory");
+ public AugeasNode getNode(AugeasNode virtualHost) {
+ List<AugeasNode> directories = AugeasNodeSearch.getNodeByParentParams(virtualHost, DIRECTORY_DIRECTIVE, position);
int index = resourceContext.getPluginConfiguration().getSimple(DIRECTIVE_INDEX_PROP).getIntegerValue();
for(AugeasNode dir : directories) {
@@ -142,4 +157,22 @@ public class ApacheDirectoryComponent implements ResourceComponent<ApacheVirtual
return null;
}
+
+ public AugeasNode getNode(){
+ ApacheVirtualHostServiceComponent virtHost = resourceContext.getParentResourceComponent();
+ AugeasTree tree = virtHost.getServerConfigurationTree();
+ AugeasNode virtHostNode = resourceContext.getParentResourceComponent().getNode(tree);
+ return getNode(virtHostNode);
+ }
+
+ public AugeasTree getServerConfigurationTree(){
+ return resourceContext.getParentResourceComponent().getServerConfigurationTree();
+ }
+
+ /**
+ * @see ApacheServerComponent#finishConfigurationUpdate(ConfigurationUpdateReport)
+ */
+ public void finishConfigurationUpdate(ConfigurationUpdateReport report) {
+ resourceContext.getParentResourceComponent().finishConfigurationUpdate(report);
+ }
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryDiscoveryComponent.java
index 5d03170..be707b9 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryDiscoveryComponent.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheDirectoryDiscoveryComponent.java
@@ -38,6 +38,7 @@ import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
import org.rhq.plugins.apache.util.AugeasNodeValueUtil;
/**
@@ -50,6 +51,9 @@ public class ApacheDirectoryDiscoveryComponent implements ResourceDiscoveryCompo
/* (non-Javadoc)
* @see org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent#discoverResources(org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext)
*/
+ public static final String DIRECTORY_DIRECTIVE = "<Directory";
+ public static final String [] PARENT_DIRECTIVES = {"<IfModule"};
+
public Set<DiscoveredResourceDetails> discoverResources(
ResourceDiscoveryContext<ApacheVirtualHostServiceComponent> context)
throws InvalidPluginConfigurationException, Exception {
@@ -66,7 +70,8 @@ public class ApacheDirectoryDiscoveryComponent implements ResourceDiscoveryCompo
return discoveredResources;
}
- List<AugeasNode> directories = tree.matchRelative(context.getParentResourceComponent().getNode(tree), "<Directory");
+ AugeasNode parentNode = context.getParentResourceComponent().getNode(tree);
+ List<AugeasNode> directories = AugeasNodeSearch.searchNode(PARENT_DIRECTIVES, DIRECTORY_DIRECTIVE, parentNode);
ResourceType resourceType = context.getResourceType();
@@ -76,7 +81,8 @@ public class ApacheDirectoryDiscoveryComponent implements ResourceDiscoveryCompo
int idx = node.getSeq();
pluginConfiguration.put(new PropertySimple(ApacheDirectoryComponent.DIRECTIVE_INDEX_PROP, idx));
-
+ String ifmoduleParams = AugeasNodeSearch.getParamsString(node, parentNode);
+ pluginConfiguration.put(new PropertySimple(ApacheDirectoryComponent.PARAMS_PROPERTY_NAME, ifmoduleParams));
List<AugeasNode> params = node.getChildByLabel("param");
String directoryParam;
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java
new file mode 100644
index 0000000..e9997bc
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleComponent.java
@@ -0,0 +1,155 @@
+package org.rhq.plugins.apache;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.augeas.node.AugeasNode;
+import org.rhq.augeas.tree.AugeasTree;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.apache.augeas.mappingImpl.MappingPositionToConfiguration;
+import org.rhq.plugins.apache.mapping.ApacheAugeasMapping;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
+
+
+
+public class ApacheIfModuleComponent implements ResourceComponent<ApacheVirtualHostServiceComponent>, ConfigurationFacet, DeleteResourceFacet {
+
+ private AugeasTree tree;
+ private ResourceContext<ApacheVirtualHostServiceComponent> context;
+ private List<String> position;
+ private ApacheVirtualHostServiceComponent parentComponent;
+ private final Log log = LogFactory.getLog(this.getClass());
+ private static final String IFMODULE_DIRECTIVE_NAME="<IfModule";
+
+ public void start(ResourceContext<ApacheVirtualHostServiceComponent> context)
+ throws InvalidPluginConfigurationException, Exception {
+
+ this.context = context;
+ parentComponent = context.getParentResourceComponent();
+ String resourceKey = context.getResourceKey();
+ position = new ArrayList<String>();
+
+ for (String pm : resourceKey.split(";")){
+ position.add(pm);
+ }
+ }
+
+ public void stop(){
+ }
+
+ public AvailabilityType getAvailability() {
+ return parentComponent.getAvailability();
+ }
+
+ public Configuration loadResourceConfiguration() throws Exception {
+ AugeasTree tree = parentComponent.getServerConfigurationTree();
+ ConfigurationDefinition resourceConfigDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ AugeasNode virtualHostNode = parentComponent.getNode(tree);
+ ApacheAugeasMapping mapping = new ApacheAugeasMapping(tree);
+ return mapping.updateConfiguration(getNode(virtualHostNode), resourceConfigDef);
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ AugeasTree tree = null;
+ try {
+ tree = parentComponent.getServerConfigurationTree();
+ ConfigurationDefinition resourceConfigDef = context.getResourceType()
+ .getResourceConfigurationDefinition();
+ ApacheAugeasMapping mapping = new ApacheAugeasMapping(tree);
+
+ AugeasNode directoryNode = getNode(parentComponent.getNode(tree));
+ mapping.updateAugeas(directoryNode, report.getConfiguration(), resourceConfigDef);
+ tree.save();
+
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ log.info("Apache configuration was updated");
+
+ context.getParentResourceComponent().finishConfigurationUpdate(report);
+ } catch (Exception e) {
+ if (tree != null)
+ log.error("Augeas failed to save configuration " + tree.summarizeAugeasError());
+ else
+ log.error("Augeas failed to save configuration", e);
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ }
+ }
+ public void deleteResource() throws Exception {
+
+ }
+
+ private AugeasNode getNode(AugeasNode virtualHost) {
+ List<AugeasNode> directories = AugeasNodeSearch.getNodeByParentParams(virtualHost, IFMODULE_DIRECTIVE_NAME, position);
+ return directories.get(0);
+ }
+
+ private void prepareNode(AugeasNode node,AugeasNode parentNode,AugeasTree tree,Configuration configuration){
+ List<String> params = AugeasNodeSearch.getParams(node, parentNode);
+
+ PropertyList list = (PropertyList)configuration.get(MappingPositionToConfiguration.LIST_PROPERTY_NAME);
+ List<String> newParams = new ArrayList<String>();
+ //get new list of params
+ for (Property prop : list.getList()){
+ if (prop instanceof PropertyMap)
+ {
+ PropertyMap propMap = (PropertyMap) prop;
+ PropertySimple value = (PropertySimple) propMap.get(MappingPositionToConfiguration.SIMPLE_PROPERTY_NAME);
+ newParams.add(value.getStringValue());
+ }
+ }
+
+ int i = 0;
+ int position = 0;
+ AugeasNode tempNode = parentNode;
+ boolean updated = true;
+
+ while (updated){
+ updated = false;
+ List<AugeasNode> nodes = tempNode.getChildByLabel(IFMODULE_DIRECTIVE_NAME);
+ for (AugeasNode nd : nodes){
+ List<AugeasNode> paramNodes = nd.getChildByLabel("param");
+ if (paramNodes.size()>0)
+ {
+ String value = paramNodes.get(0).getValue();
+ if (value.equals(newParams.get(position)))
+ {
+ position = position + 1;
+ tempNode = nd;
+ updated = true;
+ break;
+ }
+ }
+ }
+ }
+
+ for(i=position;i<newParams.size();i++){
+ int size = tempNode.getChildByLabel(IFMODULE_DIRECTIVE_NAME).size()+1;
+ tempNode = tree.createNode(tempNode, IFMODULE_DIRECTIVE_NAME, null, size);
+ tree.createNode(tempNode, "param", newParams.get(i), 1);
+ }
+ }
+
+ public void copy(AugeasNode a, AugeasNode b){
+ for (AugeasNode nd : a.getChildNodes()){
+ AugeasNode tempNode = tree.createNode(b, nd.getLabel(), nd.getValue(), nd.getSeq());
+ copy(nd,tempNode);
+ }
+ }
+
+
+}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
new file mode 100644
index 0000000..0a45cfd
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryComponent.java
@@ -0,0 +1,92 @@
+package org.rhq.plugins.apache;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.augeas.node.AugeasNode;
+import org.rhq.augeas.tree.AugeasTree;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.plugins.apache.mapping.ApacheAugeasMapping;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
+
+public class ApacheIfModuleDirectoryComponent implements ResourceComponent<ApacheDirectoryComponent>, ConfigurationFacet, DeleteResourceFacet{
+
+ private ResourceContext<ApacheDirectoryComponent> context;
+ private List<String> position;
+ private ApacheDirectoryComponent parentComponent;
+ private final Log log = LogFactory.getLog(this.getClass());
+ private static final String IFMODULE_DIRECTIVE_NAME="<IfModule";
+
+ public void start(ResourceContext<ApacheDirectoryComponent> context)
+ throws InvalidPluginConfigurationException, Exception {
+
+ this.context = context;
+ parentComponent = context.getParentResourceComponent();
+ String resourceKey = context.getResourceKey();
+ position = new ArrayList<String>();
+
+ for (String pm : resourceKey.split(";")){
+ position.add(pm);
+ }
+ }
+
+ public void stop() {
+ }
+
+ public AvailabilityType getAvailability() {
+ return parentComponent.getAvailability();
+ }
+
+ public Configuration loadResourceConfiguration() throws Exception {
+ ConfigurationDefinition resourceConfigDef = context.getResourceType().getResourceConfigurationDefinition();
+
+ AugeasNode directoryNode = parentComponent.getNode();
+ AugeasTree tree = parentComponent.getServerConfigurationTree();
+ ApacheAugeasMapping mapping = new ApacheAugeasMapping(tree);
+ return mapping.updateConfiguration(getNode(directoryNode), resourceConfigDef);
+ }
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ AugeasTree tree = null;
+ try {
+ tree = parentComponent.getServerConfigurationTree();
+ ConfigurationDefinition resourceConfigDef = context.getResourceType()
+ .getResourceConfigurationDefinition();
+ ApacheAugeasMapping mapping = new ApacheAugeasMapping(tree);
+ AugeasNode directoryNode = getNode(parentComponent.getNode());
+ mapping.updateAugeas(directoryNode, report.getConfiguration(), resourceConfigDef);
+ tree.save();
+
+ report.setStatus(ConfigurationUpdateStatus.SUCCESS);
+ log.info("Apache configuration was updated");
+
+ context.getParentResourceComponent().finishConfigurationUpdate(report);
+ } catch (Exception e) {
+ if (tree != null)
+ log.error("Augeas failed to save configuration " + tree.summarizeAugeasError());
+ else
+ log.error("Augeas failed to save configuration", e);
+ report.setStatus(ConfigurationUpdateStatus.FAILURE);
+ }
+ }
+ public void deleteResource() throws Exception {
+
+ }
+
+ private AugeasNode getNode(AugeasNode virtualHost) {
+ List<AugeasNode> directories = AugeasNodeSearch.getNodeByParentParams(virtualHost, IFMODULE_DIRECTIVE_NAME, position);
+ return directories.get(0);
+ }
+}
+
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java
new file mode 100644
index 0000000..87cb22e
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDirectoryDiscoveryComponent.java
@@ -0,0 +1,53 @@
+package org.rhq.plugins.apache;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.rhq.augeas.node.AugeasNode;
+import org.rhq.augeas.tree.AugeasTree;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
+
+public class ApacheIfModuleDirectoryDiscoveryComponent implements ResourceDiscoveryComponent<ApacheDirectoryComponent> {
+
+ private static final String [] parentRes = {"<IfModule"};
+ private static final String IFMODULE_NODE_NAME = "<IfModule";
+ private AugeasTree tree;
+ private AugeasNode parentNode;
+
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext<ApacheDirectoryComponent> context)
+ throws InvalidPluginConfigurationException, Exception {
+
+ ApacheDirectoryComponent directory = context.getParentResourceComponent();
+
+ parentNode = directory.getNode();
+
+ List<AugeasNode> ifModuleNodes = AugeasNodeSearch.searchNode(parentRes, IFMODULE_NODE_NAME, parentNode);
+
+ Set<DiscoveredResourceDetails> discoveredResources = new LinkedHashSet<DiscoveredResourceDetails>();
+ ResourceType resourceType = context.getResourceType();
+
+ for (AugeasNode node : ifModuleNodes) {
+
+ String resourceKey = AugeasNodeSearch.getParamsString(node,parentNode);
+
+ int separatorPosition = resourceKey.indexOf(";");
+ String resourceName = null;
+
+ if (separatorPosition!=-1)
+ resourceName = resourceKey.substring(0,separatorPosition);
+ else
+ resourceName = resourceKey.toString();
+
+ discoveredResources.add(new DiscoveredResourceDetails(resourceType, resourceKey, resourceName, null, null,
+ null, null));
+ }
+ return discoveredResources;
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java
new file mode 100644
index 0000000..80b25b1
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheIfModuleDiscoveryComponent.java
@@ -0,0 +1,53 @@
+package org.rhq.plugins.apache;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.rhq.augeas.node.AugeasNode;
+import org.rhq.augeas.tree.AugeasTree;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
+
+public class ApacheIfModuleDiscoveryComponent implements ResourceDiscoveryComponent<ApacheVirtualHostServiceComponent> {
+
+ private static final String [] parentRes = {"<IfModule"};
+ private static final String IFMODULE_NODE_NAME = "<IfModule";
+ private AugeasTree tree;
+ private AugeasNode parentNode;
+
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext<ApacheVirtualHostServiceComponent> context)
+ throws InvalidPluginConfigurationException, Exception {
+
+ ApacheVirtualHostServiceComponent virtualHost = context.getParentResourceComponent();
+ tree = virtualHost.getServerConfigurationTree();
+ parentNode = virtualHost.getNode(tree);
+
+ List<AugeasNode> ifModuleNodes = AugeasNodeSearch.searchNode(parentRes, IFMODULE_NODE_NAME, parentNode);
+
+ Set<DiscoveredResourceDetails> discoveredResources = new LinkedHashSet<DiscoveredResourceDetails>();
+ ResourceType resourceType = context.getResourceType();
+
+ for (AugeasNode node : ifModuleNodes) {
+
+ String resourceKey = AugeasNodeSearch.getParamsString(node,parentNode);
+
+ int separatorPosition = resourceKey.indexOf(";");
+ String resourceName = null;
+
+ if (separatorPosition!=-1)
+ resourceName = resourceKey.substring(0,separatorPosition);
+ else
+ resourceName = resourceKey.toString();
+
+ discoveredResources.add(new DiscoveredResourceDetails(resourceType, resourceKey, resourceName, null, null,
+ null, null));
+ }
+ return discoveredResources;
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
index 7b83861..e7d7e47 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/AugeasConfigurationApache.java
@@ -23,7 +23,6 @@
package org.rhq.plugins.apache.augeas;
import java.io.BufferedReader;
-import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
@@ -32,7 +31,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.rhq.augeas.config.AugeasConfiguration;
import org.rhq.augeas.config.AugeasModuleConfig;
import org.rhq.augeas.util.Glob;
import org.rhq.core.domain.configuration.Configuration;
@@ -83,7 +81,7 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
allConfigFiles = getIncludeFiles(serverRootPath, foundIncludes);
} catch (Exception e) {
- throw new AugeasRhqException(e.getMessage());
+ throw new AugeasRhqException(e);
}
}
@@ -101,13 +99,23 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
return allConfigFiles;
}
- private void loadIncludes(String expression, List<String> foundIncludes) {
- foundIncludes.add(expression);
+ private void loadIncludes(String expression, List<String> foundIncludes) {
try {
File file = new File(expression);
-
- if (file.exists()) {
- FileInputStream fstream = new FileInputStream(file);
+
+ List<File> files = new ArrayList<File>();
+
+ if (!file.isAbsolute()) {
+ File serverRootFile = new File(serverRootPath);
+ files = Glob.match(serverRootFile, expression);
+ }else
+ files.add(file);
+
+ for (File fl : files){
+ if (fl.exists()) {
+ foundIncludes.add(fl.getAbsolutePath());
+
+ FileInputStream fstream = new FileInputStream(fl);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String strLine;
while ((strLine = br.readLine()) != null) {
@@ -125,6 +133,7 @@ public class AugeasConfigurationApache extends PluginDescriptorBasedAugeasConfig
}
br.close();
}
+ }
} catch (Exception e) {
throw new IllegalStateException(e);
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java
new file mode 100644
index 0000000..9102e0a
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/augeas/mappingImpl/MappingPositionToConfiguration.java
@@ -0,0 +1,63 @@
+package org.rhq.plugins.apache.augeas.mappingImpl;
+
+import java.util.List;
+
+import org.rhq.augeas.node.AugeasNode;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.plugins.apache.util.AugeasNodeSearch;
+import org.rhq.rhqtransform.AugeasRhqException;
+import org.rhq.rhqtransform.impl.AugeasToConfigurationSimple;
+
+public class MappingPositionToConfiguration extends AugeasToConfigurationSimple {
+ public static final String LIST_PROPERTY_NAME = "IfModules";
+ public static final String MAP_PROPERTY_NAME="IfModule";
+ public static final String SIMPLE_PROPERTY_NAME="condition";
+
+ public Configuration loadResourceConfiguration(AugeasNode startNode, ConfigurationDefinition resourceConfigDef)
+ throws AugeasRhqException {
+ if (startNode == null)
+ return null;
+
+ Configuration resourceConfig = new Configuration();
+ String nodeName = startNode.getLabel();
+ AugeasNode parentNode = getParentName(startNode);
+ List<String> params = AugeasNodeSearch.getParams(startNode, parentNode);
+
+ if (nodeName.equals("<Directory"))
+ if (params.size()>0)
+ params.remove(0);
+
+ PropertyList list = new PropertyList(LIST_PROPERTY_NAME);
+ for (String parameter : params){
+ PropertyMap map = new PropertyMap(MAP_PROPERTY_NAME);
+ PropertySimple condition = new PropertySimple(SIMPLE_PROPERTY_NAME,parameter);
+ map.put(condition);
+ list.add(map);
+ }
+
+ resourceConfig.put(list);
+ return resourceConfig;
+}
+
+ private AugeasNode getParentName(AugeasNode node){
+
+ AugeasNode tempNode = node.getParentNode();
+
+ while (!tempNode.equals(tree.getRootNode())){
+ if (tempNode.getLabel().equals("<Directory"))
+ return tempNode;
+
+ if (tempNode.getLabel().equals("<VirtualHost"))
+ return tempNode;
+
+ tempNode = tempNode.getParentNode();
+ }
+
+ return tree.getRootNode();
+ }
+
+}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheAugeasMapping.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheAugeasMapping.java
index 51106fc..dc335c5 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheAugeasMapping.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheAugeasMapping.java
@@ -40,7 +40,6 @@ import org.rhq.rhqtransform.RhqAugeasMapping;
public class ApacheAugeasMapping implements RhqAugeasMapping {
private AugeasTree tree;
-
public ApacheAugeasMapping(AugeasTree tree) {
this.tree = tree;
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheDirectiveRegExpression.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheDirectiveRegExpression.java
index 3b09b54..4366d6e 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheDirectiveRegExpression.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/ApacheDirectiveRegExpression.java
@@ -64,6 +64,7 @@ public class ApacheDirectiveRegExpression {
MAPPING_TYPE.put("AllowOverride", DirectiveMapping.PARAM_PER_MAP);
MAPPING_TYPE.put("DirectoryIndex", DirectiveMapping.PARAM_PER_MAP);
MAPPING_TYPE.put("NameVirtualHost", DirectiveMapping.DIRECTIVE_PER_MAP_INDEX);
+ MAPPING_TYPE.put("IfModules",DirectiveMapping.POSITION_PROPERTY);
}
private static final String WORD = "\"(?:[^\"\n]|\\\")*\"|'(?:[^'\n]|\\\')*'|[^'\" \t\n]+";
@@ -94,7 +95,7 @@ public class ApacheDirectiveRegExpression {
.compile("(?:((?:\\[[a-zA-Z0-9:]+\\])|(?:[0-9\\.]+)):)?([0-9]+)(?:" + WS_MAN + "(" + WORD + "))?") });
DIRECTIVE_REGEX.put("ServerAlias", new Pattern[] { Pattern.compile(WS + "(" + WORD + ")") });
DIRECTIVE_REGEX.put("AllowOverride", new Pattern[] { Pattern
- .compile(WS+"(All)|(None)|(AuthConfig)|(FileInfo)|(Indexes)|(Limit)|(Options)") });
+ .compile(WS+"(All|None|AuthConfig|FileInfo|Indexes|Limit|Options)") });
DIRECTIVE_REGEX.put("DirectoryIndex", new Pattern[] { Pattern.compile(WS+ "(" + WORD + ")" + WS) });
DIRECTIVE_REGEX.put("NameVirtualHost", new Pattern[] { Pattern.compile(WS+ "(" + WORD + ")"+ WS) });
}
@@ -113,7 +114,7 @@ public class ApacheDirectiveRegExpression {
DIRECTIVEREGEX_TO_AUGEAS.put("CustomLog", new Pattern[] { Pattern.compile(WS_MAN + "(" + WORD + ")" + "(?:" + WS_MAN + "("
+ WORD + ")" + ")?") });
DIRECTIVEREGEX_TO_AUGEAS.put("AllowOverride", new Pattern[] { Pattern
- .compile(WS+"(All)|(None)|(AuthConfig)|(FileInfo)|(Indexes)|(Limit)|(Options)") });
+ .compile(WS+"(All|None|AuthConfig|FileInfo|Indexes|Limit|Options)") });
DIRECTIVEREGEX_TO_AUGEAS.put("Listen", new Pattern[] { Pattern.compile(WS_MAN+ "(" + WORD + ")")});
DIRECTIVEREGEX_TO_AUGEAS.put("NameVirtualHost", new Pattern[] { Pattern.compile(WS+ "(" + WORD +")" + WS) });
DIRECTIVEREGEX_TO_AUGEAS.put("ErrorDocument", new Pattern[] { Pattern.compile(WS_MAN + "(" + NUM + ")" + WS_MAN + "(" + WORD
@@ -155,9 +156,9 @@ public class ApacheDirectiveRegExpression {
Pattern[] patterns = DIRECTIVE_REGEX.get(nodeName);
int startIndex = 0;
-
- while (startIndex < value.length())
-
+ boolean updated = true;
+ while (updated & startIndex < value.length())
+ updated = false;
for (Pattern pattern : patterns) {
Matcher m = pattern.matcher(value);
while (m.find(startIndex)) {
@@ -165,6 +166,7 @@ public class ApacheDirectiveRegExpression {
String val = m.group(i);
result.add(val);
}
+ updated = true;
startIndex = m.end();
}
}
@@ -187,9 +189,10 @@ public class ApacheDirectiveRegExpression {
Pattern[] patterns = DIRECTIVEREGEX_TO_AUGEAS.get(name);
int startIndex = 0;
-
- while (startIndex < params.length())
-
+ boolean updated =true;
+
+ while (updated & startIndex < params.length())
+ updated = false;
for (Pattern pattern : patterns) {
Matcher m = pattern.matcher(params);
while (m.find(startIndex)) {
@@ -198,6 +201,7 @@ public class ApacheDirectiveRegExpression {
if (val!=null)
nodeParams.add(val);
}
+ updated = true;
startIndex = m.end();
}
}
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/DirectiveMapping.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/DirectiveMapping.java
index 36beb6f..77538ba 100644
--- a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/DirectiveMapping.java
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/mapping/DirectiveMapping.java
@@ -30,6 +30,7 @@ import org.rhq.plugins.apache.augeas.mappingImpl.MappingDirectivePerMap;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingDirectivePerMapIndex;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingDirectiveToSimpleProperty;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingParamPerMap;
+import org.rhq.plugins.apache.augeas.mappingImpl.MappingPositionToConfiguration;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingToAugeasDirectivePerMap;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingToAugeasDirectivePerMapIndex;
import org.rhq.plugins.apache.augeas.mappingImpl.MappingToAugeasDirectiveToSimple;
@@ -88,7 +89,18 @@ public enum DirectiveMapping {
mapping.updateResourceConfiguration(node, configDef, config);
}
},
-
+
+ POSITION_PROPERTY {
+ public Configuration mapToConfiguration(AugeasTree tree, AugeasNode startNode, ConfigurationDefinition resourceConfigDef) {
+ AugeasToConfiguration config = new MappingPositionToConfiguration();
+ config.setTree(tree);
+ return config.loadResourceConfiguration(startNode, resourceConfigDef);
+ };
+
+ public void mapToAugeas(AugeasTree tree, AugeasNode node, Configuration config, ConfigurationDefinition configDef){
+ }
+ },
+
SIMPLE_PROP {
public Configuration mapToConfiguration(AugeasTree tree, AugeasNode startNode, ConfigurationDefinition resourceConfigDef) {
AugeasToConfiguration config = new MappingDirectiveToSimpleProperty();
diff --git a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/AugeasNodeSearch.java b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/AugeasNodeSearch.java
new file mode 100644
index 0000000..fb868c1
--- /dev/null
+++ b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/util/AugeasNodeSearch.java
@@ -0,0 +1,89 @@
+package org.rhq.plugins.apache.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.rhq.augeas.node.AugeasNode;
+
+public class AugeasNodeSearch {
+ public static String [] NESTED_DIRECTIVES = {"<IfModule","<Directive","<VirtualHost","<Files"};
+
+ public static List<AugeasNode> searchNode(String [] parentNodeNames,String nodeName,AugeasNode startNode){
+ List<AugeasNode> nodes = new ArrayList<AugeasNode>();
+ search(nodes,parentNodeNames,startNode,nodeName);
+ return nodes;
+ }
+
+ private static void search(List<AugeasNode>nodes,String [] parentNodeNames,AugeasNode node,String name){
+
+ nodes.addAll(node.getChildByLabel(name));
+
+ for (String parentNodeName : parentNodeNames){
+ List<AugeasNode> nds = node.getChildByLabel(parentNodeName);
+ for (AugeasNode tempNode : nds){
+ search(nodes,parentNodeNames,tempNode, name);
+ }
+ }
+ }
+
+ public static List<AugeasNode> getNodeByParentParams(AugeasNode parentNode,String nodeName,List<String> nodeParams){
+
+ List<AugeasNode> searchedNodes = AugeasNodeSearch.searchNode(NESTED_DIRECTIVES, nodeName, parentNode);
+ List<AugeasNode> results = new ArrayList<AugeasNode>();
+
+ for (AugeasNode node : searchedNodes){
+ AugeasNode tempNode = node;
+ boolean match = true;
+ int i =0;
+
+ while (match & i<nodeParams.size() & tempNode!=parentNode){
+ List<AugeasNode> childNodes = tempNode.getChildByLabel("param");
+ if (childNodes.size()>0){
+ if (!nodeParams.get(i).equals(childNodes.get(0).getValue()))
+ match = false;
+ }else
+ match = false;
+ i=i+1;
+ tempNode = tempNode.getParentNode();
+ }
+
+ if (match==true)
+ results.add(node);
+ }
+
+ return results;
+ }
+
+ public static List<String> getParams(AugeasNode node,AugeasNode parentNode){
+ List<String> res = new ArrayList<String>();
+
+ AugeasNode pNode = node;
+ while (!pNode.equals(parentNode))
+ {
+ List<AugeasNode> paramNodes = pNode.getChildByLabel("param");
+ for (AugeasNode param : paramNodes){
+ res.add(param.getValue());
+ }
+ pNode = pNode.getParentNode();
+ }
+ return res;
+ }
+
+ public static String getParamsString(AugeasNode node,AugeasNode parentNode){
+ StringBuffer str = new StringBuffer();
+
+ AugeasNode pNode = node;
+ while (!pNode.equals(parentNode))
+ {
+ List<AugeasNode> paramNodes = pNode.getChildByLabel("param");
+ for (AugeasNode param : paramNodes){
+ str.append(param.getValue()+";");
+ }
+ pNode = pNode.getParentNode();
+ }
+
+ return str.toString();
+ }
+
+
+}
diff --git a/modules/plugins/apache/src/main/resources/Httpd.aug b/modules/plugins/apache/src/main/resources/Httpd.aug
index 06ba761..668313b 100644
--- a/modules/plugins/apache/src/main/resources/Httpd.aug
+++ b/modules/plugins/apache/src/main/resources/Httpd.aug
@@ -6,7 +6,7 @@ module Httpd =
(* Newlines can be escaped. *)
let sep = del /([ \t]+(\\\\\n)?)+/ " "
let eol = del /([ \t]*(\\\\\n)?)*\n/ "\n"
-
+ let del_str (s:string) = del s s
let ws = /[ \t]*/
let alnum = /[a-zA-Z0-9_]+/
(* the last character in the non-quoted word must not be a backslash. I guess this is not completely semantically
@@ -14,35 +14,36 @@ let alnum = /[a-zA-Z0-9_]+/
line breaking so we should be safe here. This restriction is in place to support
escaped new lines in the sep and eol rules. *)
let word = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n]*[^'" \t\n\\]/
-let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n>]+/
+let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'\" \t\n>]+/
let wskey (k:regexp) = del ws "" . key k
let params (param:regexp) = [ sep . label "param" . store param ]*
let sec (name:string) (body:lens) =
- [ wskey ("<" . name) . params secarg . Util.del_str ">" . eol .
- body . del ws "" . Util.del_str("</" . name . ">") . eol ]
+ [ wskey ("<" . name) . params secarg . del_str ">" . eol .
+ body . del ws "" . del_str("</" . name . ">") . eol ]
(* Definitions *)
let comment = [ del /([ \t]*(#.*)*)\n/ "#\n" ]
+
let directive = [ wskey alnum . params word . eol ]
let section (name:string) = sec name (directive|comment)*
-let sections = section "IfModule"
- | section "Directory"
- | section "DirectoryMatch"
- | section "Files"
- | section "FilesMatch"
- | section "Location"
- | section "LocationMatch"
- | section "AuthnProviderAlias"
- | section "IfDefine"
- | section "IfVersion"
- | section "Limit"
- | section "LimitExcept"
- | section "Proxy"
- | section "ProxyMatch"
-
-let virtualHost = sec "VirtualHost" (directive|comment|sections)*
+let sections (body:lens) = sec "Directory" body
+ | sec "DirectoryMatch" body
+ | sec "Files" body
+ | sec "FilesMatch" body
+ | sec "Location" body
+ | sec "LocationMatch" body
+ | sec "AuthnProviderAlias" body
+ | sec "IfDefine" body
+ | sec "IfVersion" body
+ | sec "Limit" body
+ | sec "LimitExcept" body
+ | sec "Proxy" body
+ | sec "ProxyMatch" body
+ | sec "VirtualHost" body
+ | sec "IfModule" body
+
(* What we want ot say is *)
(* let rec body = (directive|comment)* | ifModule body | directory body | ... *)
@@ -50,10 +51,8 @@ let virtualHost = sec "VirtualHost" (directive|comment|sections)*
(* FIXME: *)
(* - Nesting of sections *)
-let lns = (directive | comment | sections | virtualHost)*
+let rec lns = ((directive | comment)* | sections lns)*
let filter =
- incl "/etc/httpd/conf/httpd.conf" .
- Util.stdexcl
-
+ incl "/etc/httpd/conf/httpd.conf"
let xfm = transform lns filter
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index 2ebf696..930f3fc 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -47,6 +47,21 @@
</c:list-property>
'>
+<!ENTITY IfModulePosition '
+ <c:list-property name="IfModules" readOnly="true" displayName="IfModule Conditions">
+ <c:description>
+ List of modules which must be loaded to use directive configuration.
+ </c:description>
+ <c:map-property name="IfModule" readOnly="true">
+ <c:simple-property readOnly="true" name="condition">
+ <c:description>
+ Name of module which must be loaded to use the configuration.
+ </c:description>
+ </c:simple-property>
+ </c:map-property>
+ </c:list-property>
+'>
+
<!ENTITY DefaultType '
<c:simple-property name="DefaultType" default="text/plain" required="false">
<c:description>
@@ -671,6 +686,55 @@
description="Does the name of this directory denote a regular expression?"/>
</plugin-configuration>
<resource-configuration>
+ &IfModulePosition;
+ &Order;
+ &Allow;
+ &Deny;
+ <c:list-property name="AllowOverride" required="false">
+ <c:map-property name="AllowOverride" required="false">
+ <c:description>
+ When the server finds an .htaccess file (as specified by AccessFileName) it needs to know which directives declared in that file can override earlier configuration directives.
+ </c:description>
+ <c:simple-property name="param" required="false" description="Any directive which has the .htaccess Context is allowed in .htaccess files" />
+ <c:simple-property name="_index" required="false" description="Helper property to retain the consistent ordering inside Apache configuration files."/>
+ </c:map-property>
+ </c:list-property>
+ &AddDefaultCharset;
+ &DefaultType;
+ &DirectoryIndex;
+ &ErrorDocuments;
+ &Options;
+ &UseCanonicalName;
+ &UseCanonicalPhysicalPort;
+ </resource-configuration>
+ <service name="IfModule Parameters" discovery="ApacheIfModuleDirectoryDiscoveryComponent" class="ApacheIfModuleDirectoryComponent" createDeletePolicy="both">
+ <resource-configuration>
+ &IfModulePosition;
+ &Order;
+ &Allow;
+ &Deny;
+ <c:list-property name="AllowOverride" required="false">
+ <c:map-property name="AllowOverride" required="false">
+ <c:description>
+ When the server finds an .htaccess file (as specified by AccessFileName) it needs to know which directives declared in that file can override earlier configuration directives.
+ </c:description>
+ <c:simple-property name="param" required="false" description="Any directive which has the .htaccess Context is allowed in .htaccess files" />
+ <c:simple-property name="_index" required="false" description="Helper property to retain the consistent ordering inside Apache configuration files."/>
+ </c:map-property>
+ </c:list-property>
+ &AddDefaultCharset;
+ &DefaultType;
+ &DirectoryIndex;
+ &ErrorDocuments;
+ &Options;
+ &UseCanonicalName;
+ &UseCanonicalPhysicalPort;
+ </resource-configuration>
+ </service>
+ </service>
+ <service name="IfModule" discovery="ApacheIfModuleDiscoveryComponent" class="ApacheIfModuleComponent" createDeletePolicy="both">
+ <resource-configuration>
+ &IfModulePosition;
&Order;
&Allow;
&Deny;
@@ -692,7 +756,6 @@
&UseCanonicalPhysicalPort;
</resource-configuration>
</service>
-
<!-- <service name="Files" class="ApacheFilesComponent" createDeletePolicy="both">
<plugin-configuration>
<c:simple-property name="directiveIndex" readOnly="true" required="true" type="integer"/>
@@ -747,7 +810,7 @@
</plugin-configuration>
</service>
-
+
</server>
</plugin>
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
index 5c96343..94aea0a 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
@@ -114,12 +114,12 @@ public class Glob {
//move the parent path down to the nearest parent of the wildcard part of the
//glob pattern
parentPath = new File(parentPath, globPattern.substring(0, globParentIdx));
- globPattern = parentPath.getAbsolutePath() + globPattern.substring(globParentIdx);
+ globPattern = createGlobPattern(parentPath.getAbsolutePath(), globPattern.substring(globParentIdx));
} else {
- globPattern = parentPath.getAbsolutePath() + globPattern;
+ globPattern = createGlobPattern(parentPath.getAbsolutePath(),globPattern);
}
} else {
- globPattern = parentPath.getAbsolutePath() + globPattern;
+ globPattern = createGlobPattern(parentPath.getAbsolutePath(),globPattern);
}
globPattern = new File(globPattern).getAbsolutePath();
@@ -130,6 +130,11 @@ public class Glob {
return Arrays.asList(files);
}
+ private static String createGlobPattern(String parent,String pattern){
+ if (!parent.endsWith(File.separator))
+ parent = parent + File.separatorChar;
+ return parent+pattern;
+ }
public static List<File> matchAll(File parentPath, String... globPattern) {
return matchAll(parentPath, Arrays.asList(globPattern));
}
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
index 7d5cd56..2927d02 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
@@ -66,6 +66,10 @@ public class LensHelper {
}
+ public static String getTempDirectoryPath(){
+ return (String)System.getProperties().get(TEMP_DIRECTORY);
+ }
+
public static File cpFileFromPluginToTemp(File tempDirectory,String fileName) throws IOException,Exception{
File destinationFile = new File(tempDirectory,fileName);
commit 3c21fc0d894bd0992a44d8bbe64887b35358a4a7
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 13:24:41 2010 -0500
add sorting to the resource/group description field
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
index c40aa71..9d92183 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
@@ -175,7 +175,9 @@
<rich:column>
<f:facet name="header">
- <h:outputText styleClass="headerText" value="Description" />
+ <onc:sortableColumnHeader sort="rg.description">
+ <h:outputText styleClass="headerText" value="Description" />
+ </onc:sortableColumnHeader>
</f:facet>
<h:outputText value="#{item.resourceGroup.description}" />
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml
index 2551307..7890d64 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseResources.xhtml
@@ -187,7 +187,9 @@
<rich:column>
<f:facet name="header">
- <h:outputText styleClass="headerText" value="Description" />
+ <onc:sortableColumnHeader sort="r.description">
+ <h:outputText styleClass="headerText" value="Description" />
+ </onc:sortableColumnHeader>
</f:facet>
<h:outputText value="#{item.original.resource.description}" />
commit 0e6f01cbdd137691a4292fe99f0e78ea8c8bf4b5
Merge: f6e7d87... 1492651...
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 12:40:31 2010 -0500
Merge branch 'master' into search
commit f6e7d87f6cb8b2a3129b51d83781433abbcfa41d
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 12:39:58 2010 -0500
up the db.schema.version
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 1cc3eee..1d4d3dd 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.78</db.schema.version>
+ <db.schema.version>2.79</db.schema.version>
</properties>
<dependencies>
commit 5c9ddc39deba1205ed27cb361816e06af1ea34e4
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 12:37:50 2010 -0500
normalize resource group descriptions:
* add dbupgrade step to convert empty-string descriptions for existing groups into null descriptions
* add hibernate @PrePersist/@PreUpdate hooks to force empty-string descriptions to be persisted as null
note: by converting empty string descriptions to null descriptions, it gives consistent sorting between
databases that treat empty-string and null as distinct entities (e.g. postgres) and those that interpret
empty-string and null as being equivalent (oracle)
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 565b0f1..94da384 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3168,7 +3168,15 @@
<!-- Changes to RHQ_BUNDLE_FILE -->
<schema-alterColumn table="RHQ_BUNDLE_FILE" column="PACKAGE_VERSION_ID" nullable="FALSE" />
- </schemaSpec>
+ </schemaSpec>
+
+ <schemaSpec version="2.79">
+ <schema-directSQL>
+ <statement desc="Normalizing resource group descriptions">
+ UPDATE RHQ_RESOURCE_GROUP SET DESCRIPTION = NULL WHERE DESCRIPTION = ''
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
index 092c3e8..4dd051a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ResourceGroup.java
@@ -44,6 +44,8 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
@@ -627,6 +629,18 @@ public class ResourceGroup extends Group {
this.alertDefinitions = alertDefinitions;
}
+ @PrePersist
+ @PreUpdate
+ void onPersist() {
+ // always normalize empty string descriptions to NULL, which will give consistent sorting
+ // between databases that treat empty string and null as distinct entities (e.g. postgres)
+ // and those that interpret empty string and null as being equivalent (oracle)
+ String description = getDescription();
+ if (description != null && description.trim().equals("")) {
+ setDescription(null);
+ }
+ }
+
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
commit 14926513a80445b99d3ff2df3720bae81527ff6c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Feb 15 11:28:37 2010 -0500
log the obsolete msg at debug level; don't create a prepared statement unless we know we need it
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java
index 6beb1f7..3b84552 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/plugin/AgentPluginScanner.java
@@ -354,8 +354,10 @@ public class AgentPluginScanner {
cachedPluginOnFilesystem.setVersion(version);
cachedPluginOnFilesystem.setMd5(md5);
} else {
- log.info("It appears that the agent plugin [" + dbPlugin
- + "] in the database may be obsolete. If so, it will be updated by the plugin deployer.");
+ if (log.isDebugEnabled()) {
+ log.debug("It appears the agent plugin [" + dbPlugin
+ + "] in the database may be obsolete. If so, it will be updated soon.");
+ }
}
} else {
log.info("Found agent plugin in the DB that we do not yet have: " + name);
@@ -369,20 +371,22 @@ public class AgentPluginScanner {
JDBCUtil.safeClose(ps, rs);
// write all our updated plugins to the file system
- ps = conn.prepareStatement("SELECT CONTENT FROM " + Plugin.TABLE_NAME
- + " WHERE DEPLOYMENT = 'AGENT' AND NAME = ? AND ENABLED = ?");
- for (Plugin plugin : updatedPlugins) {
- File file = new File(this.agentPluginDeployer.getPluginDir(), plugin.getPath());
-
- ps.setString(1, plugin.getName());
- setEnabledFlag(conn, ps, 2, true);
- rs = ps.executeQuery();
- rs.next();
- InputStream content = rs.getBinaryStream(1);
- StreamUtil.copy(content, new FileOutputStream(file));
- rs.close();
- file.setLastModified(plugin.getMtime()); // so our file matches the database mtime
- updatedFiles.add(file);
+ if (!updatedPlugins.isEmpty()) {
+ ps = conn.prepareStatement("SELECT CONTENT FROM " + Plugin.TABLE_NAME
+ + " WHERE DEPLOYMENT = 'AGENT' AND NAME = ? AND ENABLED = ?");
+ for (Plugin plugin : updatedPlugins) {
+ File file = new File(this.agentPluginDeployer.getPluginDir(), plugin.getPath());
+
+ ps.setString(1, plugin.getName());
+ setEnabledFlag(conn, ps, 2, true);
+ rs = ps.executeQuery();
+ rs.next();
+ InputStream content = rs.getBinaryStream(1);
+ StreamUtil.copy(content, new FileOutputStream(file));
+ rs.close();
+ file.setLastModified(plugin.getMtime()); // so our file matches the database mtime
+ updatedFiles.add(file);
+ }
}
} finally {
JDBCUtil.safeClose(conn, ps, rs);
commit 9d643724360577f9f60949090f4892998343b6f7
Merge: 88735a7... 4022b03...
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 11:03:13 2010 -0500
Merge branch 'master' into search
commit 88735a710f537d05ee2aa71e2ebeb4bdef1bbf8c
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Feb 15 11:01:57 2010 -0500
fix copy/paste error which made the groupName link on the new inventory browser invalid
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
index 904bf4b..c40aa71 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/browseGroups.xhtml
@@ -148,7 +148,7 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultGroupTabURL()}">
- <f:param name="id" value="#{item.resourceGroup.id}" />
+ <f:param name="groupId" value="#{item.resourceGroup.id}" />
<h:outputText value="#{item.resourceGroup.name}" />
</h:outputLink>
</rich:column>
commit bc62a7267055e735c437104b3548479c7da38ef1
Merge: 9d3d943... 5443a98...
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Mon Feb 15 16:02:31 2010 +0100
Merge branch 'linux-config' of ssh://git.fedorahosted.org/git/rhq/rhq into linux-config
commit b729a7072f7f30cb95fd66db6ae50ad1c75cfaaa
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 15 13:44:39 2010 +0100
Add a helper to clean out a property.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index db86e3d..72f6ec8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -64,4 +64,16 @@ public class CustomAlertSenderBackingBean {
return ret;
}
+
+ protected Configuration cleanProperty(Configuration config, String propertyName) {
+
+ Configuration ret = config;
+ PropertySimple prop = config.getSimple(propertyName);
+ if (prop!=null) {
+ config.remove(propertyName);
+ ret = persistConfiguration(config);
+ }
+
+ return ret;
+ }
}
commit 5bb2553be0e2d26e1fe478fc9ca7103129367b2c
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Feb 13 13:02:55 2010 -0500
Storing validation error message in RawConfigUIBean so that they are not lost during translations
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 42404b2..68a7887 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -36,6 +36,8 @@ public class RawConfigUIBean {
private RawConfiguration rawConfiguration;
+ private String errorMessage;
+
public RawConfigUIBean(RawConfiguration rawConfiguration) {
this.rawConfiguration = rawConfiguration;
originalRawConfiguration = rawConfiguration.deepCopy(false);
@@ -82,7 +84,7 @@ public class RawConfigUIBean {
}
public String getErrorLabel() {
- if (rawConfiguration.errorMessage == null) {
+ if (errorMessage == null) {
return " ";
}
@@ -90,7 +92,11 @@ public class RawConfigUIBean {
}
public String getErrorMessage() {
- return rawConfiguration.errorMessage;
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String msg) {
+ errorMessage = msg;
}
/**
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index cdbbacf..6ab5de1 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -152,6 +152,9 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
try {
AbstractResourceConfigurationUpdate updateRequest = configurationMgr.updateStructuredOrRawConfiguration(
loggedInUser.getSubject(), resourceId, resourceConfiguration, isStructuredMode());
+
+ clearErrors();
+
if (updateRequest != null) {
switch (updateRequest.getStatus()) {
case SUCCESS:
@@ -191,13 +194,26 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
return "nochange";
}
+ private void clearErrors() {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ bean.setErrorMessage(null);
+ }
+ }
+ }
+
private void copyErrorMessages(AbstractResourceConfigurationUpdate update) {
Configuration updatedConfiguration = update.getConfiguration();
for (RawConfiguration updatedRaw : updatedConfiguration.getRawConfigurations()) {
- RawConfiguration raw = findRawConfigurationByPath(updatedRaw.getPath());
- if (raw != null) {
- raw.errorMessage = updatedRaw.errorMessage;
+ RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(updatedRaw.getPath());
+ if (rawUIBean != null) {
+ rawUIBean.setErrorMessage(updatedRaw.errorMessage);
}
+
+// RawConfiguration raw = findRawConfigurationByPath(updatedRaw.getPath());
+// if (raw != null) {
+// raw.errorMessage = updatedRaw.errorMessage;
+// }
}
}
@@ -221,6 +237,10 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
rawConfigUIBean.undoEdit();
}
+ /**
+ *
+ * @return
+ */
public String finishAddMap() {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
return "success";
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index d146afa..0645fb8 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -66,7 +66,7 @@ public class ResourceConfigurationViewer {
protected ConfigurationDefinition resourceConfigurationDefinition;
@Out(required = false)
- private Collection<RawConfigDirectory> rawConfigDirectories;
+ protected Collection<RawConfigDirectory> rawConfigDirectories;
@Out(required = false)
protected RawConfigUIBean selectedRawUIBean;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 5948355..0908a0e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -18,7 +18,7 @@
<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
- <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="10000" timeout="180000">
+ <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="15000" timeout="180000">
<action execute="#{configurationEditor.initialize}"
on-postback="false"
if="#{!conversation.longRunning or (empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id)}"/>
commit ae4a8bb65cbacf7a0316204955c4c7def3f336d7
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 22:00:15 2010 -0500
Adding support for displaying validation errors associated with individual raw config files
When there are validation errors, you are sent back to edit.xhtml. When you select a file
which has errors, a link titled, 'View Errors' will be rendered. Clicking the link will open
a modal window that displays the errors for the currently selected file.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index dd25ded..42404b2 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -81,6 +81,18 @@ public class RawConfigUIBean {
return file.getName();
}
+ public String getErrorLabel() {
+ if (rawConfiguration.errorMessage == null) {
+ return " ";
+ }
+
+ return "View Errors";
+ }
+
+ public String getErrorMessage() {
+ return rawConfiguration.errorMessage;
+ }
+
/**
* @return The name of the raw config file excluding the path. If the file has been modified, an asterisk is
* prepended to the name.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index fdd3ec9..cdbbacf 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -162,12 +162,13 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
case FAILURE:
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
- for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
- String message = raw.errorMessage;
- if (message != null) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
- }
- }
+// for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+// String message = raw.errorMessage;
+// if (message != null) {
+// FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
+// }
+// }
+ copyErrorMessages(updateRequest);
return "failure";
case NOCHANGE:
@@ -190,6 +191,26 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
return "nochange";
}
+ private void copyErrorMessages(AbstractResourceConfigurationUpdate update) {
+ Configuration updatedConfiguration = update.getConfiguration();
+ for (RawConfiguration updatedRaw : updatedConfiguration.getRawConfigurations()) {
+ RawConfiguration raw = findRawConfigurationByPath(updatedRaw.getPath());
+ if (raw != null) {
+ raw.errorMessage = updatedRaw.errorMessage;
+ }
+ }
+ }
+
+ private RawConfiguration findRawConfigurationByPath(String path) {
+ for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+ if (raw.getPath().equals(path)) {
+ return raw;
+ }
+ }
+
+ return null;
+ }
+
private void addNoChangeMsgToFacesContext() {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
+ "no update request has been sent to the Agent.");
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
index 01af8ab..afb97c1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
@@ -106,7 +106,7 @@
background-color: white;
font-style: normal;
font-weight: bold;
- color: red;
+ color: #00ff99;
}
.rich-pmenu-top-group { /* Defines styles for panel menu top group element */
@@ -157,7 +157,7 @@
padding: 1px 10px;
cursor: pointer;
text-decoration: none;
- margin-left: 5px;
+ margin-left: 5px;
}
.rawConfigFileNameCol {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 2f82d89..d10c5f4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -145,7 +145,7 @@ THIS TEXT WILL BE REMOVED.
<h:panelGroup id="lowerCommitPanel" style="text-align:right">
<h:outputText id="lowerChangedFilesLabel"
value="#{configurationEditor.modifiedFilesMsg}"
- rendered="#{configurationEditor .rawMode}"
+ rendered="#{configurationEditor.rawMode}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
action="#{configurationEditor.updateConfiguration}"
@@ -166,13 +166,16 @@ THIS TEXT WILL BE REMOVED.
<ui:include src="view-raw-modal.xhtml">
<ui:param name="readOnly" value="false"/>
</ui:include>
+
+ <ui:include src="error-window.xhtml"/>
</h:form>
<!--
upload-modal.xhtml needs to be included outside the above form because the file upload component requires its
own, separate form.
-->
- <ui:include src="upload-modal.xhtml"/>
+ <ui:include src="upload-modal.xhtml"/>
+
</ui:define>
</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml
index 1fd1afd..471f570 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml
@@ -12,7 +12,7 @@
<rich:modalPanel id="errorWindow" width="800" height="600">
<f:facet name="header">
<h:panelGroup>
- <h:outputText value="Errors"/>
+ <h:outputText value="#{selectedRawUIBean.path}"/>
</h:panelGroup>
</f:facet>
@@ -23,26 +23,13 @@
</h:panelGroup>
</f:facet>
- <rich:tabPanel switchType="client">
- <rich:tab label="Raw 1">
- <h:inputTextarea
+ <h:inputTextarea
styleClass="rawConfigFileContents"
- style="width:100%; height:100%; overflow:visible; border-width:0px"
+ style="width:100%; height:90%; overflow:visible; border-width:0px"
rows="30"
cols="30"
- value="FOO"
+ value="#{selectedRawUIBean.errorMessage}"
readonly="true"/>
- </rich:tab>
- <rich:tab label="Raw 2">
- <h:inputTextarea
- styleClass="rawConfigFileContents"
- style="width:100%; height:100%; overflow:visible; border-width:0px"
- rows="30"
- cols="30"
- value="FOO"
- readonly="true"/>
- </rich:tab>
- </rich:tabPanel>
<h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
<h:panelGroup style="text-align:right">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index d5072ea..b22194e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -74,7 +74,7 @@
oncomplete="cursor_clear()"
action="#{configurationEditor.select(rawConfigUIBean.path)}"
limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,uploadWindow"/>
+ reRender="fileContents,selectedFileHeader,modalEditor,uploadWindow,viewErrorsLink,errorWindow"/>
</h:outputLabel>
<a4j:commandButton value="Undo"
styleClass="rawConfigUndoButton"
@@ -101,11 +101,17 @@
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
+ <h:outputLink id="viewErrorsLink"
+ value="#"
+ onclick="#{rich:component('errorWindow')}.show()"
+ style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
+ #{selectedRawUIBean.errorLabel}
+ </h:outputLink>
+
<h:outputLink value="#"
onclick="#{rich:component('modalEditor')}.show()"
- style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
+ style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202); text-align: right;">
View Full Screen
</h:outputLink>
commit 4022b03cd33fada4cf04717db36507f9061c4686
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Fri Feb 12 17:51:49 2010 -0500
add ability to exclude subsets of agent plugins from the reactor
(cherry picked from commit cd68ab94767f2561f5ea658739e2147db8d9473b)
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 104a373..db7d4be 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -81,54 +81,106 @@
<modules>
<!-- core plugins -->
<module>platform</module>
- <module>jmx</module>
<module>rhq-agent</module>
- <module>apache</module>
- <module>iis</module>
- <module>database</module>
- <module>postgres</module>
-
- <!-- jboss plugins (order is important) -->
- <module>tomcat</module>
- <module>jboss-as</module>
- <module>hibernate</module>
- <module>rhq-server</module>
- <module>jboss-cache</module>
- <module>jboss-as-5</module>
- <module>jboss-cache-v3</module>
- <!-- was not in Jopr build at merge time <module>jbossOSGi</module> -->
-
- <!-- other, possibly experimental plugins -->
- <module>augeas</module>
- <module>cron</module>
- <module>script</module>
- <module>script2</module>
- <module>grub</module>
- <!-- not behaving <module>hardware</module> -->
- <module>hosts</module>
- <module>cobbler</module>
- <module>sudoers</module>
- <module>hudson</module>
- <!-- error in code generation (see RHQ-1225) <module>jira</module> -->
- <module>mysql</module>
- <module>netservices</module>
- <!-- non-public dependency <module>onewire</module> -->
- <module>oracle</module>
- <module>perftest</module>
- <module>samba</module>
- <module>postfix</module>
- <module>aliases</module>
- <module>snmptrapd</module>
- <module>sshd</module>
- <module>twitter</module>
- <module>virt</module>
- <module>kickstart</module>
-
- <!-- bundle plugins -->
- <module>filetemplate-bundle</module>
-
- <!-- make this the last - it will validate all the plugins -->
- <module>validate-all-plugins</module>
+ <module>jmx</module>
</modules>
+ <profiles>
+
+ <profile>
+ <id>jboss-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <modules>
+ <!-- NOTE: Order is important. -->
+ <module>augeas</module>
+ <module>apache</module>
+ <module>tomcat</module>
+ <module>jboss-as</module>
+ <module>hibernate</module>
+ <module>rhq-server</module>
+ <module>jboss-cache</module>
+ <module>jboss-as-5</module>
+ <module>jboss-cache-v3</module>
+ <!-- was not in Jopr build at merge time <module>jbossOSGi</module> -->
+ </modules>
+ </profile>
+
+ <profile>
+ <id>linux-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <modules>
+ <module>augeas</module>
+ <module>cron</module>
+ <module>script</module>
+ <module>script2</module>
+ <module>grub</module>
+ <!-- not behaving <module>hardware</module> -->
+ <module>hosts</module>
+ <module>cobbler</module>
+ <module>sudoers</module>
+ <module>hudson</module>
+ <module>netservices</module>
+ <module>perftest</module>
+ <module>samba</module>
+ <module>postfix</module>
+ <module>aliases</module>
+ <module>sshd</module>
+ <module>virt</module>
+ <module>kickstart</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>misc-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <modules>
+ <module>iis</module>
+ <module>database</module>
+ <module>postgres</module>
+ <module>hudson</module>
+ <!-- error in code generation (see RHQ-1225) <module>jira</module> -->
+ <module>mysql</module>
+ <!-- non-public dependency <module>onewire</module> -->
+ <module>oracle</module>
+ <module>perftest</module>
+ <module>snmptrapd</module>
+ <module>twitter</module>
+
+ <!-- bundle plugins -->
+ <module>filetemplate-bundle</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>validate-plugins</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <modules>
+ <!-- make this the last - it will validate all the plugins -->
+ <module>validate-all-plugins</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
</project>
+
commit 8f399d45949493d1fbf9cdc1c1b1ce8f57aa2983
Merge: 713a92c... 907ac7e...
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 16:53:01 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 907ac7e5bfac2dec456772ed3353e1a92831a44e
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 16:23:58 2010 -0500
Populating template enginer with values from traits. Currrent values will look like this:
hostname=ayoung.boston.devel.redhat.com
os_name=Linux
os_version=2.6.30.10-105.2.16.fc11.x86_64
architecture=x86_64
distribution_name=Fedora
distribution_version=release 11 (Leonidas)
hostname=ayoung.boston.devel.redhat.com
os_name=Linux
os_version=2.6.30.10-105.2.16.fc11.x86_64
architecture=x86_64
distribution_name=Fedora
distribution_version=release 11 (Leonidas)
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
index 3987800..03be73e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
@@ -220,31 +220,25 @@ public class ResourceUIBean {
TemplateEngine templateEngine;
public TemplateEngine getTemplateEngine() {
-
- if (null == templateEngine) {
- Map<String, String> tokens = new HashMap<String, String>();
-
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- Resource platform = this.resourceManager.getPlaformOfResource(subject, this.resource.getId());
-
- int platformId = platform.getId();
-
- MeasurementDataManagerLocal measurementDataManager = LookupUtil.getMeasurementDataManager();
-
- List<MeasurementDataTrait> traits = measurementDataManager.findCurrentTraitsForResource(subject, platform.getId(), DisplayType.DETAIL);
-
- for(MeasurementData data: traits){
- tokens.put("rhq.system."+data.getName(),data.toString());
+ try {
+ if (null == templateEngine) {
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ Resource platform = this.resourceManager.getPlaformOfResource(subject, this.resource.getId());
+ MeasurementDataManagerLocal measurementDataManager = LookupUtil.getMeasurementDataManager();
+ List<MeasurementDataTrait> traits = measurementDataManager.findCurrentTraitsForResource(subject,
+ platform.getId(), null);
+
+ Map<String, String> tokens = new HashMap<String, String>();
+ for (MeasurementData data : traits) {
+ String name = data.getName().toLowerCase().replace(' ', '_');
+ tokens.put("rhq.system." + name, data.getValue().toString());
+ }
+
+ templateEngine = new TemplateEngine(tokens);
}
-
- tokens.put("rhq.test.intval", "4");
- tokens.put("rhq.test.string", "Forty Two");
- tokens.put("rhq.resource.description", resource.getDescription());
- if (platform != null) {
- tokens.put("rhq.platform.description", platform.getDescription());
- }
-
- templateEngine = new TemplateEngine(tokens);
+ } catch (Throwable t) {
+ //No clean way to recover. This is probably indicative of a problem elsewhere
+ log.error("Cannot fetch data for template engine", t);
}
return templateEngine;
}
commit c57969f8b850c7f0b6c263f6be4f8fe2173ba6d5
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 15:17:22 2010 -0500
upgrading rich faces to fix the floating menu bug.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 33f7f88..f6fbb95 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -20,14 +20,11 @@ package org.rhq.enterprise.server.configuration;
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -53,7 +50,6 @@ import org.quartz.Trigger;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
@@ -62,7 +58,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.composite.ConfigurationUpdateComposite;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
@@ -998,6 +993,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
invalidConfig, subject.getName());
resourceConfigurationUpdate.setErrorMessage("resource.validation.failed");
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
+
return resourceConfigurationUpdate;
}
} catch (PluginContainerException e) {
diff --git a/pom.xml b/pom.xml
index 134b444..ee4dff7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
- <richfaces.version>3.3.2.SR1</richfaces.version>
+ <richfaces.version>3.3.2.GA</richfaces.version>
<sigar.version>1.6.3.82</sigar.version>
<quartz.version>1.6.5</quartz.version>
<jna.version>3.2.2</jna.version>
commit 722d78105a1aa2b4190b0a194df4b76e3e112ad3
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 14:12:33 2010 -0500
handle returned configs on the server side.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 2b01657..33f7f88 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -990,17 +990,20 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
}
try {
- Configuration invalidConfig = validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
- if (null != invalidConfig){
+ Configuration invalidConfig = validateResourceConfiguration(subject, resourceId, newConfiguration,
+ fromStructured);
+ if (null != invalidConfig) {
Resource resource = resourceManager.getResourceById(subject, resourceId);
- ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, invalidConfig, subject.getName());
+ ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource,
+ invalidConfig, subject.getName());
resourceConfigurationUpdate.setErrorMessage("resource.validation.failed");
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
return resourceConfigurationUpdate;
}
} catch (PluginContainerException e) {
Resource resource = resourceManager.getResourceById(subject, resourceId);
- ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
+ ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource,
+ newConfiguration, subject.getName());
resourceConfigurationUpdate.setErrorMessage(e.getMessage());
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
return resourceConfigurationUpdate;
commit 0e81a26fa449d5e9a1ffd65f9ea8e59a2cd2fe9d
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 14:11:22 2010 -0500
validate API now marshals objects back to the server upon validation failutre.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
index df9f715..cd5011f 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
@@ -110,14 +110,15 @@ public interface ConfigurationAgentService {
* configuration.
*
* @param configuration The Configuration with the changes to be merged
- * @param resourceId The id of the resource to which the configuration belo
- * @param A flag that if <code>true</code> indicates the Structured configu
- * validates the raw
- * @return The <strong>merged</strong> configuration, where a merge consist
- * followed by the values of the side merging from being applied to the sid
+ * @param resourceId The id of the resource to which the configuration belongs
+ * @param A flag that if <code>true</code> indicates validate the Structured configuration
+ * otherwisre, it validates the raw
+ *
+ * @return If validate succeeds, it returns null, to avoid doing any unnecessary marshaling.
+ * If validation fails, it returns the configuration object with embedded messages
* @throws PluginContainerException
* @throws PluginContainerException if a runtime or plugin error occurs.
*/
- boolean validate(Configuration configuration, int resourceId, boolean isStructured) throws PluginContainerException;
+ Configuration validate(Configuration configuration, int resourceId, boolean isStructured) throws PluginContainerException;
}
\ No newline at end of file
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 228a673..b73cc65 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
@@ -328,7 +328,7 @@ public class ConfigurationManager extends AgentService implements ContainerServi
return null;
}
- public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
+ public Configuration validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
boolean success = true;
@@ -358,6 +358,6 @@ public class ConfigurationManager extends AgentService implements ContainerServi
}
}
}
- return success;
+ return success ? null: configuration;
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 1825a70..2b01657 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -990,9 +990,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
}
try {
- if (!validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured)){
+ Configuration invalidConfig = validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
+ if (null != invalidConfig){
Resource resource = resourceManager.getResourceById(subject, resourceId);
- ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
+ ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, invalidConfig, subject.getName());
resourceConfigurationUpdate.setErrorMessage("resource.validation.failed");
resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
return resourceConfigurationUpdate;
@@ -1011,7 +1012,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return newUpdate;
}
- private boolean validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
+ private Configuration validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
boolean isStructured) throws PluginContainerException {
Resource resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index be2c8d0..45164d2 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -1087,9 +1087,9 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
@Asynchronous(guaranteedDelivery = true)
public void synchronizeInventory(ResourceSyncInfo syncInfo) {
}
- public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
+ public Configuration validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
- return true;
+ return null;
}
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
index 486a006..ebeda42 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
@@ -255,8 +255,8 @@ public class TestAgentClient implements AgentClient, ContentAgentService, Resour
return null;
}
- public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
+ public Configuration validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
- return true;
+ return null;
}
}
commit 713a92c7a55f75fedefa8161b6c7c4b918c65177
Merge: 649cd33... f300583...
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 13:58:35 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 649cd338da7726c7fd8c09b1b3943e8b2ac41bad
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 13:24:57 2010 -0500
Adding logic to gray out the upload link on view.xhtml since upload is only available on edit.xhtml
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 4f69bef..d5072ea 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -15,6 +15,15 @@
<c:choose>
<c:when test="#{readOnly}">
+ <c:set var="uploadLinkStyle" value="white-space: nowrap; font-weight: normal; color: gray"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="uploadLinkStyle" value="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);"/>
+ </c:otherwise>
+ </c:choose>
+
+ <c:choose>
+ <c:when test="#{readOnly}">
<c:set var="editor" value="#{configurationViewer}"/>
</c:when>
<c:otherwise>
@@ -103,7 +112,7 @@
<h:outputLink value="#"
disabled="#{readOnly}"
onclick="#{rich:component('uploadWindow')}.show()"
- style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
+ style="#{uploadLinkStyle}">
Upload New
</h:outputLink>
commit f30058320c6f0b0ec4a9b759a3eacd56ca23aad5
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 13:22:56 2010 -0500
Merged with jsanda's changes.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index e6236be..fdd3ec9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -46,7 +46,7 @@ import java.util.Set;
@Name("configurationEditor")
@Scope(ScopeType.CONVERSATION)
-public class ResourceConfigurationEditor extends ResourceConfigurationViewer implements Serializable {
+public class ResourceConfigurationEditor extends ResourceConfigurationViewer implements Serializable {
private Configuration originalResourceConfiguration;
@@ -142,50 +142,49 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
public boolean getRenderFileUpload() {
return isRawSupported() || isStructuredAndRawSupported();
- }
+ }
public String updateConfiguration() {
ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
- AbstractResourceConfigurationUpdate updateRequest = null;
-
try {
- configurationMgr.updateStructuredOrRawConfiguration(loggedInUser.getSubject(), resourceId,
- resourceConfiguration, isStructuredMode());
+ AbstractResourceConfigurationUpdate updateRequest = configurationMgr.updateStructuredOrRawConfiguration(
+ loggedInUser.getSubject(), resourceId, resourceConfiguration, isStructuredMode());
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ return "success";
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+ String message = raw.errorMessage;
+ if (message != null) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
+ }
+ }
+ return "failure";
+
+ case NOCHANGE:
+ addNoChangeMsgToFacesContext();
+ return "nochange";
+ }
+ }
} catch (EJBException e) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Unable to contact the remote agent.", e
.getCause());
- }
- if (updateRequest != null) {
- switch (updateRequest.getStatus()) {
- case SUCCESS:
- case INPROGRESS:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
- + updateRequest.getId() + " has been sent to the Agent.");
- return "success";
- case FAILURE:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
- + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
- for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
- String message = raw.errorMessage;
- if (message != null) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
- }
- }
- return "failure";
-
- case NOCHANGE:
- addNoChangeMsgToFacesContext();
- return "nochange";
- }
+ return "failure";
}
// updateRequest will be null if there is no change to the configuration. ConfigurationManagerBean checks to
// see if the configuration has been modified before sending the request to the agent. If no change is detected,
// it simply returns null.
-
+
addNoChangeMsgToFacesContext();
return "nochange";
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index c3bad13..be2c8d0 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -1087,8 +1087,9 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
@Asynchronous(guaranteedDelivery = true)
public void synchronizeInventory(ResourceSyncInfo syncInfo) {
}
- public void validate(Configuration configuration, int resourceId, boolean isStructured)
+ public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
+ return true;
}
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
index 2c13eb6..486a006 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/TestAgentClient.java
@@ -255,7 +255,8 @@ public class TestAgentClient implements AgentClient, ContentAgentService, Resour
return null;
}
- public void validate(Configuration configuration, int resourceId, boolean isStructured)
+ public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
+ return true;
}
}
commit e033eab765a95ec47001c12da8010f97120d0993
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 11:38:30 2010 -0500
Thought I got rid of this long time ago.
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java b/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java
deleted file mode 100644
index 1ded750..0000000
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.rhq.core.gui.converter;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-import org.rhq.core.template.TemplateEngine;
-
-public class TemplateEngineConverter implements Converter {
-
- private final TemplateEngine templateEngine;
-
- public TemplateEngineConverter(TemplateEngine templateEngine) {
- this.templateEngine = templateEngine;
- }
-
- public Object getAsObject(FacesContext context, UIComponent component, String value) {
- if (null == value){
- return "";
- }
- return templateEngine.replaceTokens(value);
- }
-
- public String getAsString(FacesContext context, UIComponent component, Object value) {
- if (value == null)return "";
- return templateEngine.replaceTokens(value.toString());
- }
-
-}
commit 8b039adab3a9a9267ce4d19187dca81597d9fb4b
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 11:34:58 2010 -0500
Config pages don't die if they can't atlk to the agent. Got rid of unused class. Implemented some simple validation for nss.
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index 38a3f59..b277663 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@ -42,7 +42,7 @@ public interface ResourceConfigurationFacet {
void persistRawConfiguration(RawConfiguration rawConfiguration);
- void validateStructuredConfiguration(Configuration configuration);
+ void validateStructuredConfiguration(Configuration configuration) throws IllegalArgumentException;
- void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException;
+ void validateRawConfiguration(RawConfiguration rawConfiguration) throws IllegalArgumentException;
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 801f9a4..e6236be 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -36,6 +36,9 @@ import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.model.UploadItem;
+
+import javax.ejb.EJBException;
import javax.faces.application.FacesMessage;
import java.io.Serializable;
import java.util.HashSet;
@@ -105,8 +108,7 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
// There is kind of an implicit else block to do nothing. If the file is modified and already in the cache,
// then that means we have already incremented the number of files modified, so we do not need to
// increment again.
- }
- else if (modifiedFiles.contains(rawConfigUIBean.getPath())) {
+ } else if (modifiedFiles.contains(rawConfigUIBean.getPath())) {
// We fall into this block if the file is not modified and if the cache contains the file, which means it
// was previously in a modified state; therefore, we remove it from the cache, and decrement the number of
// files modified.
@@ -147,9 +149,15 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
- AbstractResourceConfigurationUpdate updateRequest = configurationMgr.updateStructuredOrRawConfiguration(
- loggedInUser.getSubject(), resourceId, resourceConfiguration, isStructuredMode());
+ AbstractResourceConfigurationUpdate updateRequest = null;
+ try {
+ configurationMgr.updateStructuredOrRawConfiguration(loggedInUser.getSubject(), resourceId,
+ resourceConfiguration, isStructuredMode());
+ } catch (EJBException e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Unable to contact the remote agent.", e
+ .getCause());
+ }
if (updateRequest != null) {
switch (updateRequest.getStatus()) {
case SUCCESS:
@@ -167,7 +175,7 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
}
}
return "failure";
-
+
case NOCHANGE:
addNoChangeMsgToFacesContext();
return "nochange";
diff --git a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
index f4c43ff..b1dbcc6 100644
--- a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
+++ b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -229,30 +229,35 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
}
- public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
-
+ public void validateRawConfiguration(RawConfiguration rawConfiguration) throws IllegalArgumentException {
+ throw new IllegalArgumentException("bad config file");
}
- public void validateStructuredConfiguration(Configuration configuration) {
+ public void validateStructuredConfiguration(Configuration configuration) throws IllegalArgumentException {
+ boolean success = true;
for (Property prop : configuration.getProperties()) {
- validateProperty(prop);
+ success &= validateProperty(prop);
+ }
+ if (!success) {
+ throw new IllegalArgumentException();
}
-
}
- private static void validateProperty(Property prop) {
+ private static boolean validateProperty(Property prop) {
String[] vals = ((PropertySimple) prop).getStringValue().split(" ");
ArrayList<String> invalidServices = new ArrayList<String>();
ArrayList<String> invalidRules = new ArrayList<String>();
-
+ boolean success = true;
for (String val : vals) {
if (val.startsWith("[")) {
if (!rulePattern.matcher(val).matches()) {
invalidRules.add(val);
+ success = false;
}
} else {
if (!serviceSet.contains(val)) {
invalidServices.add(val);
+ success = false;
}
}
}
@@ -266,6 +271,7 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
if (errorMessage.length() > 0) {
prop.setErrorMessage(errorMessage.toString());
}
+ return success;
}
private static void buildErrorMessage(ArrayList<String> errors, StringBuilder errorMessage, String type) {
@@ -292,7 +298,7 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
{
String noMatch = "# abcd: val";
-
+
Matcher matcher = linePattern.matcher(noMatch);
if (matcher.matches()) {
System.exit(1);
@@ -323,13 +329,13 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
System.exit(1);
}
}
-
+
{
PropertySimple prop = new PropertySimple("passwd", "nisplus [UNUSED=return] [!NOWAY=return] files");
validateProperty(prop);
if (prop.getErrorMessage() != null) {
System.out.println("error message is '" + prop.getErrorMessage() + "'");
- }else{
+ } else {
System.exit(1);
}
}
@@ -339,22 +345,21 @@ public class NameServiceSwitchComponent implements ResourceComponent<NameService
validateProperty(prop);
if (prop.getErrorMessage() != null) {
System.out.println("error message is '" + prop.getErrorMessage() + "'");
- }else{
+ } else {
System.exit(1);
}
}
-
{
- PropertySimple prop = new PropertySimple("passwd", "nisplus nope neither [UNUSED=return] [!NOWAY=return] garbage junk files");
+ PropertySimple prop = new PropertySimple("passwd",
+ "nisplus nope neither [UNUSED=return] [!NOWAY=return] garbage junk files");
validateProperty(prop);
if (prop.getErrorMessage() != null) {
System.out.println("error message is '" + prop.getErrorMessage() + "'");
- }else{
+ } else {
System.exit(1);
}
}
-
}
}
commit 3fa505a0e42cc5865a85ea85030f9d1755fccb99
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 12 09:53:31 2010 -0500
Validation now returns true or false, not an excpetion, to indicate whether validation passed or failed. This should allow marshalling of the error messages back to the server.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
index c5ee507..df9f715 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationAgentService.java
@@ -118,6 +118,6 @@ public interface ConfigurationAgentService {
* @throws PluginContainerException
* @throws PluginContainerException if a runtime or plugin error occurs.
*/
- void validate(Configuration configuration, int resourceId, boolean isStructured) throws PluginContainerException;
+ boolean validate(Configuration configuration, int resourceId, boolean isStructured) throws PluginContainerException;
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index 7356cd0..d016f50 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -267,6 +267,8 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
copy.setContents(this.getContents());
}
+ copy.errorMessage = this.errorMessage;
+
return copy;
}
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 2de07f8..228a673 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
@@ -186,7 +186,6 @@ public class ConfigurationManager extends AgentService implements ContainerServi
private void mergeRawsIntoStructured(Configuration configuration, ResourceConfigurationFacet facet) {
Configuration structuredConfig = facet.loadStructuredConfiguration();
-
if (structuredConfig != null) {
prepareConfigForMergeIntoStructured(configuration, structuredConfig);
@@ -329,10 +328,10 @@ public class ConfigurationManager extends AgentService implements ContainerServi
return null;
}
- public void validate(Configuration configuration, int resourceId, boolean isStructured)
+ public boolean validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
- boolean thereAreErrors = false;
+ boolean success = true;
boolean daemonOnly = true;
boolean onlyIfStarted = true;
@@ -342,7 +341,7 @@ public class ConfigurationManager extends AgentService implements ContainerServi
try {
facet.validateStructuredConfiguration(configuration);
} catch (IllegalArgumentException e) {
- thereAreErrors = true;
+ success = false;
} catch (Throwable t) {
throw new PluginContainerException(t.getMessage(), t);
}
@@ -351,16 +350,14 @@ public class ConfigurationManager extends AgentService implements ContainerServi
try {
facet.validateRawConfiguration(rawConfiguration);
} catch (IllegalArgumentException e) {
- thereAreErrors = true;
+ success = false;
rawConfiguration.errorMessage = e.getMessage();
} catch (Throwable t) {
- thereAreErrors = true;
+ success = false;
rawConfiguration.errorMessage = t.getMessage();
}
}
}
- if (thereAreErrors) {
- throw new PluginContainerException("One or more files failed validation");
- }
+ return success;
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index aac3b24..1825a70 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -990,7 +990,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
}
try {
- validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
+ if (!validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured)){
+ Resource resource = resourceManager.getResourceById(subject, resourceId);
+ ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
+ resourceConfigurationUpdate.setErrorMessage("resource.validation.failed");
+ resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
+ return resourceConfigurationUpdate;
+ }
} catch (PluginContainerException e) {
Resource resource = resourceManager.getResourceById(subject, resourceId);
ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
@@ -1005,7 +1011,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return newUpdate;
}
- private void validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
+ private boolean validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
boolean isStructured) throws PluginContainerException {
Resource resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
@@ -1018,7 +1024,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Agent agent = resource.getAgent();
AgentClient agentClient = this.agentManager.getAgentClient(agent);
ConfigurationAgentService configService = agentClient.getConfigurationAgentService();
- configService.validate(configuration, resourceId, isStructured);
+ return configService.validate(configuration, resourceId, isStructured);
}
private boolean isRawSupported(int resourceId) {
commit 8125827f8f4f8c640d54d9502800879f70718c01
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Feb 11 21:36:31 2010 -0500
Added a plugin for nsswitch, might be necessary to show the structured validation errors in the future.
diff --git a/.classpath b/.classpath
index 64df586..980e44a 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
- <classpathentry kind="src" path="modules/plugins/nameservice-switch-plugin/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/nss/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/>
diff --git a/modules/plugins/nss/pom.xml b/modules/plugins/nss/pom.xml
index ec3a42f..2c6b06d 100644
--- a/modules/plugins/nss/pom.xml
+++ b/modules/plugins/nss/pom.xml
@@ -8,7 +8,7 @@
<groupId>org.rhq.plugin.nss</groupId>
<artifactId>nameservices-switch-plugin</artifactId>
- <version>0.0.6</version>
+ <version>0.0.7</version>
<packaging>jar</packaging>
<name>Name Service Switch</name>
diff --git a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
index 23aee6f..f4c43ff 100644
--- a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
+++ b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -25,15 +25,11 @@ import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import com.sun.org.apache.bcel.internal.generic.NEW;
-
-import org.apache.commons.lang.Validate;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index 6b7d884..a39d6e2 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -55,9 +55,27 @@
</plugin-configuration>
<resource-configuration configurationFormat="both">
- <c:simple-property name="x" description="A simple property that is represented in both structured and raw"/>
- <c:simple-property name="y" description="A simple property that is represented in both structured and raw"/>
- <c:simple-property name="z" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="x" description="A simple property that is represented in both structured and raw" type="integer">
+ <c:constraint>
+ <c:integer-constraint minimum="0"/>
+ <c:integer-constraint maximum="5"/>
+ </c:constraint>
+ </c:simple-property>
+
+
+ <c:simple-property name="y" description="A simple property that is represented in both structured and raw" type="integer" >
+ <c:constraint>
+ <c:integer-constraint minimum="6"/>
+ <c:integer-constraint maximum="10"/>
+ </c:constraint>
+ </c:simple-property>
+ <c:simple-property name="z" description="A simple property that is represented in both structured and raw" type="integer" >
+ <c:constraint>
+ <c:integer-constraint minimum="20"/>
+ <c:integer-constraint maximum="30"/>
+ </c:constraint>
+
+ </c:simple-property>
<c:simple-property name="username" description="A simple property that is represented in both structured and raw"/>
<c:simple-property name="password" description="A simple property that is represented in both structured and raw"/>
<c:simple-property name="rhq.server.hostname" description="A simple property that is represented in both structured and raw"/>
commit 0853825d7b7ee6a720fea796fbd128788e566404
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Feb 11 21:35:51 2010 -0500
Wired up the templating engine to run prior to validation. However, it only has some sample data in it right now, and needs to be populated from the traits.
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractConfigurationComponent.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractConfigurationComponent.java
index 91185e6..ed21239 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractConfigurationComponent.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractConfigurationComponent.java
@@ -32,6 +32,7 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.gui.configuration.propset.ConfigurationSetComponent;
import org.rhq.core.gui.util.FacesComponentIdFactory;
import org.rhq.core.gui.util.FacesComponentUtility;
+import org.rhq.core.template.TemplateEngine;
/**
* An abstract base class for the {@link ConfigUIComponent} and the {@link ConfigurationSetComponent} JSF component
@@ -185,10 +186,12 @@ public abstract class AbstractConfigurationComponent extends UIComponentBase imp
private Object[] stateValues;
+ private TemplateEngine templateEngine;
+
@Override
public Object saveState(FacesContext facesContext) {
if (this.stateValues == null) {
- this.stateValues = new Object[7];
+ this.stateValues = new Object[8];
}
this.stateValues[0] = super.saveState(facesContext);
@@ -198,6 +201,8 @@ public abstract class AbstractConfigurationComponent extends UIComponentBase imp
this.stateValues[4] = this.listIndex;
this.stateValues[5] = this.prevalidate;
this.stateValues[6] = this.isGroup;
+ this.stateValues[7] = this.templateEngine;
+
return this.stateValues;
}
@@ -211,6 +216,9 @@ public abstract class AbstractConfigurationComponent extends UIComponentBase imp
this.listIndex = (Integer) this.stateValues[4];
this.prevalidate = (Boolean) this.stateValues[5];
this.isGroup = (Boolean) this.stateValues[6];
+ this.templateEngine = (TemplateEngine) this.stateValues[7];
}
+ abstract public TemplateEngine getTemplateEngine() ;
+
}
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractPropertyBagUIComponentTreeFactory.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractPropertyBagUIComponentTreeFactory.java
index e17f23c..da8b453 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractPropertyBagUIComponentTreeFactory.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/AbstractPropertyBagUIComponentTreeFactory.java
@@ -58,6 +58,7 @@ import org.rhq.core.gui.configuration.propset.ConfigurationSetComponent;
import org.rhq.core.gui.util.FacesComponentUtility;
import org.rhq.core.gui.util.FacesExpressionUtility;
import org.rhq.core.gui.util.PropertyIdGeneratorUtility;
+import org.rhq.core.template.TemplateEngine;
/**
* A factory that generates a tree of JSF components that depicts a given collection of JON {@link Property}s.
@@ -130,6 +131,7 @@ public abstract class AbstractPropertyBagUIComponentTreeFactory {
this.topLevel = topLevel;
this.valueExpressionFormat = valueExpressionFormat;
this.overrideExpressionFormat = getOverrideExpressionFormat(valueExpressionFormat);
+
// The below variable is for the new group config impl being implemented by Ian.
this.isGroup = (this.config instanceof ConfigurationSetComponent);
if (this.isGroup) {
@@ -280,7 +282,7 @@ public abstract class AbstractPropertyBagUIComponentTreeFactory {
private void addProperty(UIComponent parent, PropertyDefinition propertyDefinition, String rowStyleClass) {
if (propertyDefinition instanceof PropertyDefinitionSimple) {
- addSimpleProperty(parent, (PropertyDefinitionSimple) propertyDefinition, rowStyleClass);
+ addSimpleProperty(parent, (PropertyDefinitionSimple) propertyDefinition, rowStyleClass, config.getTemplateEngine());
} else if (propertyDefinition instanceof PropertyDefinitionList) {
addListProperty(parent, (PropertyDefinitionList) propertyDefinition, rowStyleClass);
} else if (propertyDefinition instanceof PropertyDefinitionMap) {
@@ -349,7 +351,7 @@ public abstract class AbstractPropertyBagUIComponentTreeFactory {
}
private void addSimpleProperty(UIComponent parent, PropertyDefinitionSimple propertyDefinitionSimple,
- String rowStyleClass) {
+ String rowStyleClass, TemplateEngine templateEngine) {
addDebug(parent, true, ".addSimpleProperty()");
FacesComponentUtility.addVerbatimText(parent, "\n\n<tr class='" + rowStyleClass + "'>");
@@ -364,7 +366,7 @@ public abstract class AbstractPropertyBagUIComponentTreeFactory {
// need to know the input component's id in order to render the unset control.
input = PropertyRenderingUtility.createInputForSimpleProperty(propertyDefinitionSimple, propertySimple,
propertyValueExpression, getListIndex(), this.isGroup, this.config.isReadOnly(), this.config
- .isFullyEditable(), this.config.isPrevalidate());
+ .isFullyEditable(), this.config.isPrevalidate(), templateEngine);
FacesComponentUtility
.addVerbatimText(parent, "<td class='" + CssStyleClasses.PROPERTY_DISPLAY_NAME_CELL + "'>");
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigUIComponent.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigUIComponent.java
index 771aa15..9fc983d 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigUIComponent.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/ConfigUIComponent.java
@@ -1,32 +1,33 @@
- /*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.gui.configuration;
- import org.jetbrains.annotations.Nullable;
- import org.rhq.core.domain.configuration.Configuration;
- import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
- import org.rhq.core.gui.util.FacesComponentIdFactory;
- import org.rhq.core.gui.util.FacesComponentUtility;
+import org.jetbrains.annotations.Nullable;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.gui.util.FacesComponentIdFactory;
+import org.rhq.core.gui.util.FacesComponentUtility;
+import org.rhq.core.template.TemplateEngine;
/**
* A component that represents an RHQ configuration and its associated definition.
@@ -34,10 +35,11 @@ package org.rhq.core.gui.configuration;
* @author Ian Springer
*/
public class ConfigUIComponent extends AbstractConfigurationComponent implements FacesComponentIdFactory {
- public static final String COMPONENT_TYPE = "org.jboss.on.Config";
+ public static final String COMPONENT_TYPE = "org.jboss.on.Config";
private static final String CONFIGURATION_DEFINITION_ATTRIBUTE = "configurationDefinition";
private static final String CONFIGURATION_ATTRIBUTE = "configuration";
+ private static final String TEMPLATE_ENGINE_ATTRIBUTE = "templateEngine";
@Nullable
public ConfigurationDefinition getConfigurationDefinition() {
@@ -55,12 +57,22 @@ public class ConfigUIComponent extends AbstractConfigurationComponent implements
return config;
}
- public String getConfigurationDefinitionExpressionString()
- {
+ public String getConfigurationDefinitionExpressionString() {
return getValueExpression(CONFIGURATION_DEFINITION_ATTRIBUTE).getExpressionString();
}
public String getConfigurationExpressionString() {
return getValueExpression(CONFIGURATION_ATTRIBUTE).getExpressionString();
}
+
+ public String getTemplateEngineString() {
+ return getValueExpression("").getExpressionString();
+ }
+
+ public TemplateEngine getTemplateEngine() {
+ TemplateEngine templateEngine = FacesComponentUtility.getExpressionAttribute(this, TEMPLATE_ENGINE_ATTRIBUTE,
+ TemplateEngine.class);
+ return templateEngine;
+ };
+
}
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
index c73205a..bae99cd 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/helper/PropertyRenderingUtility.java
@@ -58,6 +58,7 @@ import org.rhq.core.gui.util.FacesComponentUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.core.gui.util.PropertyIdGeneratorUtility;
import org.rhq.core.gui.validator.PropertySimpleValueValidator;
+import org.rhq.core.template.TemplateEngine;
/**
* A class that provides methods for rendering RHQ {@link Property}s.
@@ -87,7 +88,7 @@ public class PropertyRenderingUtility {
@NotNull
public static UIInput createInputForSimpleProperty(PropertyDefinitionSimple propertyDefinitionSimple,
PropertySimple propertySimple, ValueExpression propertyValueExpression, Integer listIndex,
- boolean isGroupConfig, boolean configReadOnly, boolean configFullyEditable, boolean prevalidate) {
+ boolean isGroupConfig, boolean configReadOnly, boolean configFullyEditable, boolean prevalidate, TemplateEngine templateEngine) {
UIInput input = createInput(propertyDefinitionSimple);
if (propertySimple != null)
@@ -105,7 +106,7 @@ public class PropertyRenderingUtility {
FacesComponentUtility.setUnset(input, isUnset);
FacesComponentUtility.setReadonly(input, isReadOnly);
- addValidatorsAndConverter(input, propertyDefinitionSimple, configReadOnly);
+ addValidatorsAndConverter(input, propertyDefinitionSimple, configReadOnly, templateEngine);
addErrorMessages(input, propertyDefinitionSimple, propertySimple, prevalidate);
return input;
@@ -470,11 +471,11 @@ public class PropertyRenderingUtility {
}
private static void addValidatorsAndConverter(UIInput input, PropertyDefinitionSimple propertyDefinitionSimple,
- boolean readOnly) {
+ boolean readOnly,TemplateEngine templateEngine ) {
if (!readOnly) {
input.setRequired(propertyDefinitionSimple.isRequired());
input.addValidator(new PropertySimpleValueValidator(propertyDefinitionSimple));
- input.setConverter(new PropertySimpleValueConverter());
+ input.setConverter(new PropertySimpleValueConverter(templateEngine));
}
}
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSetComponent.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSetComponent.java
index e79c307..95eb6f3 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSetComponent.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/ConfigurationSetComponent.java
@@ -33,6 +33,7 @@ import org.rhq.core.gui.configuration.AbstractConfigurationComponent;
import org.rhq.core.gui.util.FacesComponentIdFactory;
import org.rhq.core.gui.util.FacesComponentUtility;
import org.rhq.core.gui.util.FacesExpressionUtility;
+import org.rhq.core.template.TemplateEngine;
/**
* A component that represents a set of RHQ Configurations which share the same ConfigurationDefinition.
@@ -92,4 +93,10 @@ public class ConfigurationSetComponent extends AbstractConfigurationComponent im
UIForm configSetForm = FacesComponentUtility.getEnclosingForm(this);
return (HtmlModalPanel) configSetForm.getParent().findComponent(getPropSetModalPanelId(this));
}
+
+ @Override
+ public TemplateEngine getTemplateEngine() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/PropertySetRenderer.java b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/PropertySetRenderer.java
index de1620e..1d802ef 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/PropertySetRenderer.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/configuration/propset/PropertySetRenderer.java
@@ -372,7 +372,7 @@ public class PropertySetRenderer extends Renderer {
if (propertyDefinitionSimple != null)
input = PropertyRenderingUtility.createInputForSimpleProperty(propertyDefinitionSimple, propertyInfo
.getProperty(), propertyInfo.getPropertyValueExpression(), propertySetComponent.getListIndex(), false,
- propertySetComponent.getReadOnly(), false, true);
+ propertySetComponent.getReadOnly(), false, true,null);
else
input = PropertyRenderingUtility.createInputForSimpleProperty(propertyInfo.getProperty(), propertyInfo
.getPropertyValueExpression(), propertySetComponent.getReadOnly());
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/converter/PropertySimpleValueConverter.java b/modules/core/gui/src/main/java/org/rhq/core/gui/converter/PropertySimpleValueConverter.java
index c8421bf..0c7336a 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/converter/PropertySimpleValueConverter.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/converter/PropertySimpleValueConverter.java
@@ -22,6 +22,10 @@
*/
package org.rhq.core.gui.converter;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
@@ -30,65 +34,70 @@ import javax.faces.convert.Converter;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
+import org.rhq.core.gui.configuration.AbstractConfigurationComponent;
+import org.rhq.core.template.TemplateEngine;
+
/**
* @author Ian Springer
*/
-public class PropertySimpleValueConverter implements Converter
-{
+
+public class PropertySimpleValueConverter implements Converter , Serializable{
+
+ TemplateEngine engine = null;
+
+
+ public void setEngine(TemplateEngine engine) {
+ this.engine = engine;
+ }
+
+ public PropertySimpleValueConverter(TemplateEngine engine ) {
+ this.engine = engine;
+ }
+
/**
* A special value for an input that tells the server-side that the corresponding value should be set to null.
*/
public static final String NULL_INPUT_VALUE = " ";
- public Object getAsObject(FacesContext context, UIComponent component, String string)
- {
+ public Object getAsObject(FacesContext context, UIComponent component, String string) {
+
+ if ((engine != null) && (string != null)) {
+ string = engine.replaceTokens(string);
+ }
//noinspection UnnecessaryLocalVariable
Object object = NULL_INPUT_VALUE.equals(string) ? null : string;
+
validateEmptyString(context, component, string);
return object;
}
- public String getAsString(FacesContext facesContext, UIComponent component, Object object)
- {
+ public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
//noinspection UnnecessaryLocalVariable
- String string = (String)object;
+ String string = (String) object;
return string;
}
- private static void validateEmptyString(FacesContext context, UIComponent component, String string)
- {
- UIInput input = (UIInput)component;
- if (input.isValid() && string != null && string.length() == 0)
- {
- if (input.getValidators() != null)
- {
- for (Validator validator : input.getValidators())
- {
- try
- {
+ private static void validateEmptyString(FacesContext context, UIComponent component, String string) {
+ UIInput input = (UIInput) component;
+ if (input.isValid() && string != null && string.length() == 0) {
+ if (input.getValidators() != null) {
+ for (Validator validator : input.getValidators()) {
+ try {
validator.validate(context, input, string);
- }
- catch (ValidatorException ve)
- {
+ } catch (ValidatorException ve) {
// If the validator throws an exception, we're
// invalid, and we need to add a message
input.setValid(false);
FacesMessage message;
String validatorMessageString = input.getValidatorMessage();
- if (null != validatorMessageString)
- {
- message =
- new FacesMessage(FacesMessage.SEVERITY_ERROR,
- validatorMessageString,
- validatorMessageString);
+ if (null != validatorMessageString) {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, validatorMessageString,
+ validatorMessageString);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
- }
- else
- {
+ } else {
message = ve.getFacesMessage();
}
- if (message != null)
- {
+ if (message != null) {
context.addMessage(input.getClientId(context), message);
}
}
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/validator/PropertySimpleValueValidator.java b/modules/core/gui/src/main/java/org/rhq/core/gui/validator/PropertySimpleValueValidator.java
index 0263dab..15aa917 100644
--- a/modules/core/gui/src/main/java/org/rhq/core/gui/validator/PropertySimpleValueValidator.java
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/validator/PropertySimpleValueValidator.java
@@ -73,7 +73,7 @@ public class PropertySimpleValueValidator implements Validator, StateHolder {
public void validate(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException {
String stringValue = (String) value;
-
+
String refresh = FacesContextUtility.getOptionalRequestParameter("refresh");
if (refresh != null && refresh.equals(ConfigRenderer.PROPERTY_SET_COMPONENT_ID))
return;
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 3506512..2de07f8 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
@@ -54,7 +54,7 @@ import org.rhq.core.pc.util.LoggingThreadFactory;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.system.SystemInfoFactory;
-import org.rhq.core.template.TemplateEngine;
+
import org.rhq.core.util.exception.WrappedRemotingException;
/**
@@ -186,15 +186,13 @@ public class ConfigurationManager extends AgentService implements ContainerServi
private void mergeRawsIntoStructured(Configuration configuration, ResourceConfigurationFacet facet) {
Configuration structuredConfig = facet.loadStructuredConfiguration();
- TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
if (structuredConfig != null) {
prepareConfigForMergeIntoStructured(configuration, structuredConfig);
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
- String contents = templateEngine.replaceTokens(new String(rawConfig.getContents()));
+ String contents = rawConfig.getContents();
rawConfig.setContents(contents);
-
structuredConfig.addRawConfiguration(rawConfig);
facet.mergeStructuredConfiguration(rawConfig, configuration);
}
@@ -218,14 +216,13 @@ public class ConfigurationManager extends AgentService implements ContainerServi
prepareConfigForMergeIntoRaws(configuration, rawConfigs);
Queue<RawConfiguration> queue = new LinkedList<RawConfiguration>(rawConfigs);
- TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
while (!queue.isEmpty()) {
RawConfiguration originalRaw = queue.poll();
RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
if (mergedRaw != null) {
//TODO bypass validation of structured config for template values
- mergedRaw.setContents(templateEngine.replaceTokens(mergedRaw.getContents()));
+ mergedRaw.setContents(mergedRaw.getContents());
updateRawConfig(configuration, originalRaw, mergedRaw);
}
}
diff --git a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
index 0e56625..113771d 100644
--- a/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
+++ b/modules/core/util/src/main/java/org/rhq/core/template/TemplateEngine.java
@@ -1,10 +1,16 @@
package org.rhq.core.template;
+import java.io.Serializable;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class TemplateEngine {
+public class TemplateEngine implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6490715202402123042L;
+
private final Map<String, String> tokens;
/**
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
index c919f6e..3987800 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/ResourceUIBean.java
@@ -18,7 +18,9 @@
*/
package org.rhq.enterprise.gui.inventory.resource;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -29,17 +31,24 @@ import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.DisplayType;
+import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceError;
import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceAvailabilitySummary;
import org.rhq.core.domain.resource.composite.ResourceFacets;
import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.core.template.TemplateEngine;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
+import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility;
import org.rhq.enterprise.server.perspective.PerspectiveManagerLocal;
import org.rhq.enterprise.server.perspective.Tab;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@@ -208,4 +217,40 @@ public class ResourceUIBean {
return canShowParent;
}
+ TemplateEngine templateEngine;
+
+ public TemplateEngine getTemplateEngine() {
+
+ if (null == templateEngine) {
+ Map<String, String> tokens = new HashMap<String, String>();
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ Resource platform = this.resourceManager.getPlaformOfResource(subject, this.resource.getId());
+
+ int platformId = platform.getId();
+
+ MeasurementDataManagerLocal measurementDataManager = LookupUtil.getMeasurementDataManager();
+
+ List<MeasurementDataTrait> traits = measurementDataManager.findCurrentTraitsForResource(subject, platform.getId(), DisplayType.DETAIL);
+
+ for(MeasurementData data: traits){
+ tokens.put("rhq.system."+data.getName(),data.toString());
+ }
+
+ tokens.put("rhq.test.intval", "4");
+ tokens.put("rhq.test.string", "Forty Two");
+ tokens.put("rhq.resource.description", resource.getDescription());
+ if (platform != null) {
+ tokens.put("rhq.platform.description", platform.getDescription());
+ }
+
+ templateEngine = new TemplateEngine(tokens);
+ }
+ return templateEngine;
+ }
+
+ public void setTemplateEngine(TemplateEngine templateEngine) {
+ this.templateEngine = templateEngine;
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml
index e23ad6b..49ff1b0 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml
@@ -22,6 +22,7 @@
readOnly="#{readOnly}"
nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
nullConfigurationMessage="#{msg['resource.configuration.null']}"
+ templateEngine="#{ResourceUIBean.templateEngine}"
prevalidate="true"/>
</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 01c9b7d..df663de 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2086,6 +2086,32 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return queryRunner.execute();
}
+ public Resource getPlaformOfResource(Subject subject, int resourceId) {
+ Resource resource = null;
+ Resource parent = null;
+ do {
+ resource = parent;
+ if (resource != null) {
+ resourceId = parent.getId();
+ }
+ parent = getParentResource(resourceId);
+ int parentId = parent.getId();
+ if (parent.getResourceType().getCategory().equals(ResourceCategory.PLATFORM)){
+ resource = parent;
+ parent = null;
+ break;
+ }
+
+ } while (parent != null);
+ if (resource != null) {
+ if (!authorizationManager.canViewResource(subject, resource.getId())) {
+ throw new PermissionException("User [" + subject + "] does not have permission to view resource ["
+ + resource.getId() + "]");
+ }
+ }
+ return resource;
+ }
+
public Resource getParentResource(Subject subject, int resourceId) {
Resource resource = getParentResource(resourceId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 95445de..32b38c8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -433,5 +433,8 @@ public interface ResourceManagerLocal {
PageList<Resource> findChildResources(Subject subject, int resourceId, PageControl pageControl);
+ Resource getPlaformOfResource(Subject subject, int resourceId);
+
+
Resource getParentResource(Subject subject, int resourceId);
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
index dd3fb3a..e642866 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerRemote.java
@@ -138,5 +138,5 @@ public interface ResourceManagerRemote {
Resource getParentResource( //
@WebParam(name = "subject") Subject subject, //
@WebParam(name = "resourceId") int resourceId);
-
+
}
\ No newline at end of file
commit e9aebf8d4a14e7ec1dd1aa33c67cdd9a42336c85
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 10 13:19:03 2010 -0500
shortened the name to nss
diff --git a/modules/plugins/nameservice-switch-plugin/pom.xml b/modules/plugins/nameservice-switch-plugin/pom.xml
deleted file mode 100644
index ec3a42f..0000000
--- a/modules/plugins/nameservice-switch-plugin/pom.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.rhq.plugin.nss</groupId>
- <artifactId>nameservices-switch-plugin</artifactId>
- <version>0.0.6</version>
- <packaging>jar</packaging>
-
- <name>Name Service Switch</name>
- <description>A Plugin for managing the Name Service Switch infrastructure of a Linux System</description>
-
- <properties>
- <rhq.version>1.4.0-SNAPSHOT</rhq.version>
- </properties>
-
- <dependencies>
-
- <!-- Below are the core modules that are required dependencies of all plugins -->
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-plugin-api</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-native-system</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>hibernate-annotations</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.2.1.GA</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!--
- Uncomment the one of the three logging systems your plugin uses: log4j, commons-logging or i18nlog
- All three are provided to your plugin by the agent/plugin-container.
- -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Define any third-party dependencies your plugin has here. -->
- <!--
- <dependency>
- <groupId>group-id-of-dependency-goes-here</groupId>
- <artifactId>artifact-id-of-dependency-goes-here</artifactId>
- <version>version-of-dependency-goes-here</version>
- </dependency>
- -->
-
- </dependencies>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-plugin-validator</artifactId>
- <version>${rhq.version}</version>
- </plugin>
-
-
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>dev</id>
- <properties>
- <rhq.rootDir>../../..</rhq.rootDir>
- <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath>
- <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <id>deploy</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${rhq.deploymentDir}" />
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating ${deployment.file}...</echo>
- <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy-jar-meta-inf</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
- <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
- <patternset>
- <include name="META-INF/**" />
- </patternset>
- </unjar>
- <jar destfile="${deployment.file}"
- manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
- update="true">
- </jar>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>undeploy</id>
- <phase>clean</phase>
- <configuration>
- <tasks>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Deleting ${deployment.file}...</echo>
- <delete file="${deployment.file}" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <repositories>
- <repository>
- <id>jboss</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>jboss</id>
- <name>JBoss Plugin Repository</name>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-</project>
diff --git a/modules/plugins/nameservice-switch-plugin/pom.xml~ b/modules/plugins/nameservice-switch-plugin/pom.xml~
deleted file mode 100644
index 517ccf4..0000000
--- a/modules/plugins/nameservice-switch-plugin/pom.xml~
+++ /dev/null
@@ -1,255 +0,0 @@
-<?xml version="1.0"?>
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.rhq.sample.skeletonplugin</groupId>
- <artifactId>skeleton-plugin</artifactId>
- <version>1.0</version>
- <packaging>jar</packaging>
-
- <name>Skeleton RHQ Plugin Template</name>
- <description>A template for building a custom RHQ agent plugin</description>
-
- <properties>
- <rhq.version>1.4.0-SNAPSHOT</rhq.version>
- </properties>
-
- <dependencies>
-
- <!-- Below are the core modules that are required dependencies of all plugins -->
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-plugin-api</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-native-system</artifactId>
- <version>${rhq.version}</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>hibernate-annotations</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.2.1.GA</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope> <!-- provided by the agent/plugin-container -->
- </dependency>
-
- <!--
- Uncomment the one of the three logging systems your plugin uses: log4j, commons-logging or i18nlog
- All three are provided to your plugin by the agent/plugin-container.
- -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
-
- <!--
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
- -->
-
- <!--
- <dependency>
- <groupId>i18nlog</groupId>
- <artifactId>i18nlog</artifactId>
- <version>1.0.9</version>
- <scope>provided</scope>
- </dependency>
- -->
-
- <!-- Define any third-party dependencies your plugin has here. -->
- <!--
- <dependency>
- <groupId>group-id-of-dependency-goes-here</groupId>
- <artifactId>artifact-id-of-dependency-goes-here</artifactId>
- <version>version-of-dependency-goes-here</version>
- </dependency>
- -->
-
- </dependencies>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-plugin-validator</artifactId>
- <version>${rhq.version}</version>
- </plugin>
-
- <!--
- If your plugin has third-party jar dependencies that are not already available when deployed in the plugin
- container, you can package these jars in your plugin. They go in your plugin jar's "lib" directory.
- Uncomment the maven plugin definition below and define one or more jar files (aka "artifactItem" elements)
- that you want to include in your plugin jar.
- -->
- <!--
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>your-third-party-dep-group</groupId>
- <artifactId>your-third-party-dep-artifact</artifactId>
- <version>your-third-party-dep-version</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- -->
-
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>dev</id>
- <properties>
- <!-- define the location of your RHQ root directory - typically rhq.rootDir is overridden in Maven's settings.xml -->
- <rhq.rootDir>/rhq/trunk</rhq.rootDir>
- <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath>
- <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir>
- </properties>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <id>deploy</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${rhq.deploymentDir}" />
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating ${deployment.file}...</echo>
- <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>deploy-jar-meta-inf</id>
- <phase>package</phase>
- <configuration>
- <tasks>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
- <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
- <patternset>
- <include name="META-INF/**" />
- </patternset>
- </unjar>
- <jar destfile="${deployment.file}"
- manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
- update="true">
- </jar>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>undeploy</id>
- <phase>clean</phase>
- <configuration>
- <tasks>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Deleting ${deployment.file}...</echo>
- <delete file="${deployment.file}" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <repositories>
- <repository>
- <id>jboss</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>jboss</id>
- <name>JBoss Plugin Repository</name>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
-</project>
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
deleted file mode 100644
index a1bd599..0000000
--- a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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.plugin.nss;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
-
-/**
- * Allows the RHQ server to manage the Name Server Switch Configuration for a Linux Platform
- *
- * @author Adam Young
- */
-public class NameServiceSwitchComponent implements ResourceComponent<NameServiceSwitchComponent>, OperationFacet, ResourceConfigurationFacet {
- private static final String ETC_NSSWITCH_CONF = "/tmp/nsswitch.conf";
- //private static final String ETC_NSSWITCH_CONF = "/etc/nsswitch.conf";
-
- private final Log log = LogFactory.getLog(NameServiceSwitchComponent.class);
-
- private static Pattern linePattern = Pattern.compile("\\s*(\\p{Alpha}*):((?:\\s|\\p{Alpha}|\\[|\\]|\\=)*)");
-
- /**
- * Represents the resource configuration of the custom product being managed.
- */
- private Configuration resourceConfiguration;
-
- /**
- * All AMPS plugins are stateful - this context contains information that your resource component can use when
- * performing its processing.
- */
- private ResourceContext resourceContext;
-
- /**
- * This is called when your component has been started with the given context. You normally initialize some internal
- * state of your component as well as attempt to make a stateful connection to your managed resource.
- *
- * @see ResourceComponent#start(ResourceContext)
- */
- public void start(ResourceContext context) {
- resourceContext = context;
- }
-
- /**
- * This is called when the component is being stopped, usually due to the plugin container shutting down. You can
- * perform some cleanup here; though normally not much needs to be done here.
- *
- * @see ResourceComponent#stop()
- */
- public void stop() {
- }
-
- /**
- * All resource components must be able to tell the plugin container if the managed resource is available or not.
- * This method is called by the plugin container when it needs to know if the managed resource is actually up and
- * available.
- *
- * @see ResourceComponent#getAvailability()
- */
- public AvailabilityType getAvailability() {
- // TODO: here you normally make some type of connection attempt to the managed resource
- // to determine if it is really up and running.
- return AvailabilityType.UP;
- }
-
- /**
- * The plugin container will call this method when it wants to invoke an operation on your managed resource. Your
- * plugin will connect to the managed resource and invoke the analogous operation in your own custom way.
- *
- * @see OperationFacet#invokeOperation(String, Configuration)
- */
- public OperationResult invokeOperation(String name, Configuration configuration) {
- return null;
- }
-
- static public String getContents(File aFile) {
- //...checks on aFile are elided
- StringBuilder contents = new StringBuilder();
-
- try {
- //use buffering, reading one line at a time
- //FileReader always assumes default encoding is OK!
- BufferedReader input = new BufferedReader(new FileReader(aFile));
- try {
- String line = null; //not declared within while loop
- /*
- * readLine is a bit quirky :
- * it returns the content of a line MINUS the newline.
- * it returns null only for the END of the stream.
- * it returns an empty String if two newlines appear in a row.
- */
- while ((line = input.readLine()) != null) {
- contents.append(line);
- contents.append(System.getProperty("line.separator"));
- }
- } finally {
- input.close();
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
-
- return contents.toString();
- }
-
- public Set<RawConfiguration> loadRawConfigurations() {
-
- Set<RawConfiguration> raws = new HashSet<RawConfiguration>();
- RawConfiguration raw = new RawConfiguration();
-
- raw.setPath(ETC_NSSWITCH_CONF);
-
- raw.setContents(getContents(new File(raw.getPath())));
-
- raws.add(raw);
- return raws;
- }
-
- public Configuration loadStructuredConfiguration() {
- Configuration configuration = new Configuration();
- for (RawConfiguration raw : loadRawConfigurations()) {
- mergeStructuredConfiguration(raw,configuration);
- }
-
- return configuration;
- }
-
- public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void mergeStructuredConfiguration(RawConfiguration from, Configuration to) {
-
- ArrayList<Property> properties = new ArrayList<Property>();
-
- to.addRawConfiguration(from);
- try {
- BufferedReader input = new BufferedReader(new StringReader(from.getContents()));
- String line = null; //not declared within while loop
- while ((line = input.readLine()) != null) {
- Matcher matcher = linePattern.matcher(line);
- if (matcher.matches()) {
- properties.add(new PropertySimple(matcher.group(1), matcher.group(2).trim()));
- }
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- to.setProperties(properties);
-
- }
-
- public void persistRawConfiguration(RawConfiguration rawConfiguration) {
-
-
-
- }
-
- public void persistStructuredConfiguration(Configuration configuration) {
- // TODO Auto-generated method stub
-
- }
-
- public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
- // TODO Auto-generated method stub
-
- }
-
- public void validateStructuredConfiguration(Configuration configuration) {
- // TODO Auto-generated method stub
-
- }
-
-
- public static void main(String[] args){
- String noMatch = "# abcd: val";
- String yesMatch = "bootparams: nisplus [NOTFOUND=return] files";
-
- Matcher matcher = linePattern.matcher(noMatch);
- if (matcher.matches()) {
- System.exit(1);
- }
- matcher = linePattern.matcher(yesMatch);
-
-
- if (matcher.matches()){
- System.out.println("Group0="+matcher.group(1));
- System.out.println("Group1="+matcher.group(2).trim());
- }
-
-
- }
-}
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
deleted file mode 100644
index e0d1958..0000000
--- a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.plugin.nss;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
-import org.rhq.core.pluginapi.inventory.ProcessScanResult;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-
-
-/**
- *
- *Discovers if the Linux platform is using NSSWitch
- * @author Adam Young
- */
-public class NameServiceSwitchDiscoveryComponent implements ResourceDiscoveryComponent<NameServiceSwitchComponent> {
- private final Log log = LogFactory.getLog(NameServiceSwitchDiscoveryComponent.class);
-
- /**
- * Review the javadoc for both {@link ResourceDiscoveryComponent} and {@link ResourceDiscoveryContext} to learn what
- * you need to do in this method.
- *
- * @see ResourceDiscoveryComponent#discoverResources(ResourceDiscoveryContext)
- */
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
- log.info("Calling discoverResources for NSS");
-
- // if your plugin descriptor defined one or more <process-scan>s, then see if the plugin container
- // auto-discovered processes using those process scan definitions. Process all those that were found.
- List<ProcessScanResult> autoDiscoveryResults = context.getAutoDiscoveredProcesses();
- for (ProcessScanResult autoDiscoveryResult : autoDiscoveryResults) {
- // determine if you want to include the result in this method's returned set of discovered resources
- }
-
- List<Configuration> pluginConfigs = context.getPluginConfigurations();
- for (Configuration pluginConfig : pluginConfigs) {
- // pluginConfig contains information on a resource that was manually discovered/entered by the user
- // take it and build a details object that represents that resource
- }
-
- // now perform your own discovery mechanism, if you have one. For each resource discovered, you need to
- // create a details object that describe the resource that you discovered.
- HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
-
- // key = this must be a unique string across all of your resources - see docs for uniqueness rules
- // name = this is the name you give the new resource; it does not necessarily have to be unique
- // version = this is any string that corresponds to the resource's version
- // description = this is any string that you want to assign as the default description for your resource
- String key = "NSSwitch";
- String name = "NSSwitch";
- String version = "0.0.2";
- String description = "Name Service Switch Infrastructure";
-
- DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), key, name,
- version, description, null, null);
-
- set.add(resource);
-
- return set;
- }
-}
\ No newline at end of file
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
deleted file mode 100644
index 305129e..0000000
--- a/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<plugin name=""
- displayName="Name Service Switch"
- version="1.0"
- package="org.rhq.plugin.nss"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:xmlns:rhq-plugin"
- xmlns:c="urn:xmlns:rhq-configuration">
-
- <server name="Name Server Switch"
- discovery="NameServiceSwitchDiscoveryComponent"
- class="NameServiceSwitchComponent"
- description="Name Service Switch Component">
- <resource-configuration configurationFormat="both">
- <c:simple-property name="passwd" displayName="passwd" default="" />
- <c:simple-property name="shadow" displayName="shadow" default="" />
- <c:simple-property name="group" displayName="group" default="" />
- <c:simple-property name="hosts" displayName="hosts" default="" />
- <c:simple-property name="bootparams" displayName="bootparams" default="" />
- <c:simple-property name="ethers" displayName="ethers" default="" />
- <c:simple-property name="netmasks" displayName="netmasks" default="" />
- <c:simple-property name="networks" displayName="networks" default="" />
- <c:simple-property name="protocols" displayName="protocols" default="" />
- <c:simple-property name="rpc" displayName="rpc" default="" />
- <c:simple-property name="services" displayName="services" default="" />
- <c:simple-property name="netgroup" displayName="netgroup" default="" />
- <c:simple-property name="publickey" displayName="publickey" default="" />
- <c:simple-property name="automount" displayName="automount" default="" />
- <c:simple-property name="aliases" displayName="aliases" default="" />
- </resource-configuration>
- </server>
-</plugin>
diff --git a/modules/plugins/nss/pom.xml b/modules/plugins/nss/pom.xml
new file mode 100644
index 0000000..ec3a42f
--- /dev/null
+++ b/modules/plugins/nss/pom.xml
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq.plugin.nss</groupId>
+ <artifactId>nameservices-switch-plugin</artifactId>
+ <version>0.0.6</version>
+ <packaging>jar</packaging>
+
+ <name>Name Service Switch</name>
+ <description>A Plugin for managing the Name Service Switch infrastructure of a Linux System</description>
+
+ <properties>
+ <rhq.version>1.4.0-SNAPSHOT</rhq.version>
+ </properties>
+
+ <dependencies>
+
+ <!-- Below are the core modules that are required dependencies of all plugins -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>hibernate-annotations</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.2.1.GA</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!--
+ Uncomment the one of the three logging systems your plugin uses: log4j, commons-logging or i18nlog
+ All three are provided to your plugin by the agent/plugin-container.
+ -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Define any third-party dependencies your plugin has here. -->
+ <!--
+ <dependency>
+ <groupId>group-id-of-dependency-goes-here</groupId>
+ <artifactId>artifact-id-of-dependency-goes-here</artifactId>
+ <version>version-of-dependency-goes-here</version>
+ </dependency>
+ -->
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-plugin-validator</artifactId>
+ <version>${rhq.version}</version>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>dev</id>
+ <properties>
+ <rhq.rootDir>../../..</rhq.rootDir>
+ <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}"
+ manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss</id>
+ <name>JBoss Plugin Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
new file mode 100644
index 0000000..23aee6f
--- /dev/null
+++ b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -0,0 +1,364 @@
+/*
+ * 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.plugin.nss;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.sun.org.apache.bcel.internal.generic.NEW;
+
+import org.apache.commons.lang.Validate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+/**
+ * Allows the RHQ server to manage the Name Server Switch Configuration for a Linux Platform
+ *
+ * @author Adam Young
+ */
+public class NameServiceSwitchComponent implements ResourceComponent<NameServiceSwitchComponent>, OperationFacet,
+ ResourceConfigurationFacet {
+
+ /**
+ * The standard location for the configuration file
+ */
+ private static final String ETC_NSSWITCH_CONF = "/tmp/nsswitch.conf";
+ //private static final String ETC_NSSWITCH_CONF = "/etc/nsswitch.conf";
+
+ private final Log log = LogFactory.getLog(NameServiceSwitchComponent.class);
+
+ /**
+ * The set of Services supported by NSS.
+ */
+ final static String[] SERVICES = { "compat", "db", "dns", "files", "hesiod", "nis", "nisplus" };
+
+ final static String[] DATABASES = { "aliases", /*Mail aliases, used by sendmail(8). Presently ignored.*/
+ "ethers", /*Ethernet numbers.*/
+ "group", /*Groups of users, used by getgrent(3) functions.*/
+ "hosts", /*Host names and numbers, used by gethostbyname(3) and
+ similar functions.*/
+ "netgroup", /*Network wide list of hosts and users, used for access rules.
+ C libraries before glibc 2.1 only support netgroups over NIS.*/
+ "networks", /*Network names and numbers, used by getnetent(3) functions.*/
+ "passwd", /*passwd User passwords, used by getpwent(3) functions.*/
+ "protocols", /* Network protocols, used by getprotoent(3) functions.*/
+ "publickey", /*Public and secret keys for Secure_RPC used by NFS and NIS+.*/
+ "rpc", /*Remote procedure call names and numbers, used by getrpcbyname(3)
+ and similar functions.*/
+ "services" /*shadow Shadow user passwords, used by getspnam(3).*/};
+
+ /**
+ * TODO, Add any custom services registered on the machine
+ */
+ static Set<String> serviceSet = new HashSet<String>(Arrays.asList(SERVICES));
+
+ final static Pattern rulePattern = Pattern
+ .compile("\\[!?(success|notfound|unavail|tryagain|SUCCESS|NOTFOUND|UNAVAIL|TRYAGAIN)=(return|continue|RETURN|CONTINUE)\\]");
+
+ private static Pattern linePattern = Pattern.compile("\\s*(\\p{Alpha}*):((?:\\s|\\p{Alpha}|\\[|\\]|\\=)*)");
+
+ /**
+ * Represents the resource configuration of the custom product being managed.
+ */
+ private Configuration resourceConfiguration;
+
+ /**
+ * All AMPS plugins are stateful - this context contains information that your resource component can use when
+ * performing its processing.
+ */
+ private ResourceContext resourceContext;
+
+ /**
+ * This is called when your component has been started with the given context. You normally initialize some internal
+ * state of your component as well as attempt to make a stateful connection to your managed resource.
+ *
+ * @see ResourceComponent#start(ResourceContext)
+ */
+ public void start(ResourceContext context) {
+ resourceContext = context;
+ }
+
+ /**
+ * This is called when the component is being stopped, usually due to the plugin container shutting down. You can
+ * perform some cleanup here; though normally not much needs to be done here.
+ *
+ * @see ResourceComponent#stop()
+ */
+ public void stop() {
+ }
+
+ /**
+ * All resource components must be able to tell the plugin container if the managed resource is available or not.
+ * This method is called by the plugin container when it needs to know if the managed resource is actually up and
+ * available.
+ *
+ * @see ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+ // TODO: here you normally make some type of connection attempt to the managed resource
+ // to determine if it is really up and running.
+ return AvailabilityType.UP;
+ }
+
+ /**
+ * The plugin container will call this method when it wants to invoke an operation on your managed resource. Your
+ * plugin will connect to the managed resource and invoke the analogous operation in your own custom way.
+ *
+ * @see OperationFacet#invokeOperation(String, Configuration)
+ */
+ public OperationResult invokeOperation(String name, Configuration configuration) {
+ return null;
+ }
+
+ static public String getContents(File aFile) {
+ //...checks on aFile are elided
+ StringBuilder contents = new StringBuilder();
+
+ try {
+ //use buffering, reading one line at a time
+ //FileReader always assumes default encoding is OK!
+ BufferedReader input = new BufferedReader(new FileReader(aFile));
+ try {
+ String line = null; //not declared within while loop
+ /*
+ * readLine is a bit quirky :
+ * it returns the content of a line MINUS the newline.
+ * it returns null only for the END of the stream.
+ * it returns an empty String if two newlines appear in a row.
+ */
+ while ((line = input.readLine()) != null) {
+ contents.append(line);
+ contents.append(System.getProperty("line.separator"));
+ }
+ } finally {
+ input.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+
+ return contents.toString();
+ }
+
+ public Set<RawConfiguration> loadRawConfigurations() {
+
+ Set<RawConfiguration> raws = new HashSet<RawConfiguration>();
+ RawConfiguration raw = new RawConfiguration();
+
+ raw.setPath(ETC_NSSWITCH_CONF);
+
+ raw.setContents(getContents(new File(raw.getPath())));
+
+ raws.add(raw);
+ return raws;
+ }
+
+ public Configuration loadStructuredConfiguration() {
+ Configuration configuration = new Configuration();
+ for (RawConfiguration raw : loadRawConfigurations()) {
+ mergeStructuredConfiguration(raw, configuration);
+ }
+ return configuration;
+ }
+
+ public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void mergeStructuredConfiguration(RawConfiguration from, Configuration to) {
+
+ ArrayList<Property> properties = new ArrayList<Property>();
+
+ to.addRawConfiguration(from);
+ try {
+ BufferedReader input = new BufferedReader(new StringReader(from.getContents()));
+ String line = null; //not declared within while loop
+ while ((line = input.readLine()) != null) {
+ Matcher matcher = linePattern.matcher(line);
+ if (matcher.matches()) {
+ properties.add(new PropertySimple(matcher.group(1), matcher.group(2).trim()));
+ }
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ to.setProperties(properties);
+
+ }
+
+ public void persistRawConfiguration(RawConfiguration rawConfiguration) {
+
+ }
+
+ public void persistStructuredConfiguration(Configuration configuration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
+
+ }
+
+ public void validateStructuredConfiguration(Configuration configuration) {
+ for (Property prop : configuration.getProperties()) {
+ validateProperty(prop);
+ }
+
+ }
+
+ private static void validateProperty(Property prop) {
+ String[] vals = ((PropertySimple) prop).getStringValue().split(" ");
+ ArrayList<String> invalidServices = new ArrayList<String>();
+ ArrayList<String> invalidRules = new ArrayList<String>();
+
+ for (String val : vals) {
+ if (val.startsWith("[")) {
+ if (!rulePattern.matcher(val).matches()) {
+ invalidRules.add(val);
+ }
+ } else {
+ if (!serviceSet.contains(val)) {
+ invalidServices.add(val);
+ }
+ }
+ }
+ StringBuilder errorMessage = new StringBuilder();
+ if (!invalidServices.isEmpty()) {
+ buildErrorMessage(invalidServices, errorMessage, "Service");
+ }
+ if (!invalidRules.isEmpty()) {
+ buildErrorMessage(invalidRules, errorMessage, "Rule");
+ }
+ if (errorMessage.length() > 0) {
+ prop.setErrorMessage(errorMessage.toString());
+ }
+ }
+
+ private static void buildErrorMessage(ArrayList<String> errors, StringBuilder errorMessage, String type) {
+ if (errors.size() == 1) {
+ errorMessage.append(errors.get(0));
+ errorMessage.append(" is not a valid NSS " + type + ".");
+ } else {
+ int i = 0;
+ for (String db : errors) {
+ errorMessage.append(db);
+ if (i < (errors.size() - 1)) {
+ errorMessage.append(", ");
+ }
+ if (i == (errors.size() - 2)) {
+ errorMessage.append("and ");
+ }
+ ++i;
+ }
+ errorMessage.append(" are not a valid NSS Services. ");
+ }
+ }
+
+ public static void main(String[] args) {
+
+ {
+ String noMatch = "# abcd: val";
+
+ Matcher matcher = linePattern.matcher(noMatch);
+ if (matcher.matches()) {
+ System.exit(1);
+ }
+ }
+ {
+ String yesMatch = "bootparams: nisplus [NOTFOUND=return] files";
+ Matcher matcher = linePattern.matcher(yesMatch);
+
+ if (matcher.matches()) {
+ System.out.println("Group0=" + matcher.group(1));
+ System.out.println("Group1=" + matcher.group(2).trim());
+ }
+ }
+ {
+ PropertySimple prop = new PropertySimple("passwd", "nisplus [NOTFOUND=return] files");
+ validateProperty(prop);
+ if (prop.getErrorMessage() != null) {
+ System.out.println("error message is '" + prop.getErrorMessage() + "'");
+ System.exit(1);
+ }
+ }
+ {
+ PropertySimple prop = new PropertySimple("passwd", "nisplus [NOTFOUND=return] files");
+ validateProperty(prop);
+ if (prop.getErrorMessage() != null) {
+ System.out.println("error message is '" + prop.getErrorMessage() + "'");
+ System.exit(1);
+ }
+ }
+
+ {
+ PropertySimple prop = new PropertySimple("passwd", "nisplus [UNUSED=return] [!NOWAY=return] files");
+ validateProperty(prop);
+ if (prop.getErrorMessage() != null) {
+ System.out.println("error message is '" + prop.getErrorMessage() + "'");
+ }else{
+ System.exit(1);
+ }
+ }
+
+ {
+ PropertySimple prop = new PropertySimple("passwd", "nisplus nope neither garbage junk files");
+ validateProperty(prop);
+ if (prop.getErrorMessage() != null) {
+ System.out.println("error message is '" + prop.getErrorMessage() + "'");
+ }else{
+ System.exit(1);
+ }
+ }
+
+
+ {
+ PropertySimple prop = new PropertySimple("passwd", "nisplus nope neither [UNUSED=return] [!NOWAY=return] garbage junk files");
+ validateProperty(prop);
+ if (prop.getErrorMessage() != null) {
+ System.out.println("error message is '" + prop.getErrorMessage() + "'");
+ }else{
+ System.exit(1);
+ }
+ }
+
+
+ }
+}
diff --git a/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
new file mode 100644
index 0000000..e0d1958
--- /dev/null
+++ b/modules/plugins/nss/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
@@ -0,0 +1,83 @@
+/*
+ * 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.plugin.nss;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ProcessScanResult;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+
+/**
+ *
+ *Discovers if the Linux platform is using NSSWitch
+ * @author Adam Young
+ */
+public class NameServiceSwitchDiscoveryComponent implements ResourceDiscoveryComponent<NameServiceSwitchComponent> {
+ private final Log log = LogFactory.getLog(NameServiceSwitchDiscoveryComponent.class);
+
+ /**
+ * Review the javadoc for both {@link ResourceDiscoveryComponent} and {@link ResourceDiscoveryContext} to learn what
+ * you need to do in this method.
+ *
+ * @see ResourceDiscoveryComponent#discoverResources(ResourceDiscoveryContext)
+ */
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
+ log.info("Calling discoverResources for NSS");
+
+ // if your plugin descriptor defined one or more <process-scan>s, then see if the plugin container
+ // auto-discovered processes using those process scan definitions. Process all those that were found.
+ List<ProcessScanResult> autoDiscoveryResults = context.getAutoDiscoveredProcesses();
+ for (ProcessScanResult autoDiscoveryResult : autoDiscoveryResults) {
+ // determine if you want to include the result in this method's returned set of discovered resources
+ }
+
+ List<Configuration> pluginConfigs = context.getPluginConfigurations();
+ for (Configuration pluginConfig : pluginConfigs) {
+ // pluginConfig contains information on a resource that was manually discovered/entered by the user
+ // take it and build a details object that represents that resource
+ }
+
+ // now perform your own discovery mechanism, if you have one. For each resource discovered, you need to
+ // create a details object that describe the resource that you discovered.
+ HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+
+ // key = this must be a unique string across all of your resources - see docs for uniqueness rules
+ // name = this is the name you give the new resource; it does not necessarily have to be unique
+ // version = this is any string that corresponds to the resource's version
+ // description = this is any string that you want to assign as the default description for your resource
+ String key = "NSSwitch";
+ String name = "NSSwitch";
+ String version = "0.0.2";
+ String description = "Name Service Switch Infrastructure";
+
+ DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), key, name,
+ version, description, null, null);
+
+ set.add(resource);
+
+ return set;
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/nss/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/nss/src/main/resources/META-INF/rhq-plugin.xml
new file mode 100644
index 0000000..305129e
--- /dev/null
+++ b/modules/plugins/nss/src/main/resources/META-INF/rhq-plugin.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<plugin name=""
+ displayName="Name Service Switch"
+ version="1.0"
+ package="org.rhq.plugin.nss"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <server name="Name Server Switch"
+ discovery="NameServiceSwitchDiscoveryComponent"
+ class="NameServiceSwitchComponent"
+ description="Name Service Switch Component">
+ <resource-configuration configurationFormat="both">
+ <c:simple-property name="passwd" displayName="passwd" default="" />
+ <c:simple-property name="shadow" displayName="shadow" default="" />
+ <c:simple-property name="group" displayName="group" default="" />
+ <c:simple-property name="hosts" displayName="hosts" default="" />
+ <c:simple-property name="bootparams" displayName="bootparams" default="" />
+ <c:simple-property name="ethers" displayName="ethers" default="" />
+ <c:simple-property name="netmasks" displayName="netmasks" default="" />
+ <c:simple-property name="networks" displayName="networks" default="" />
+ <c:simple-property name="protocols" displayName="protocols" default="" />
+ <c:simple-property name="rpc" displayName="rpc" default="" />
+ <c:simple-property name="services" displayName="services" default="" />
+ <c:simple-property name="netgroup" displayName="netgroup" default="" />
+ <c:simple-property name="publickey" displayName="publickey" default="" />
+ <c:simple-property name="automount" displayName="automount" default="" />
+ <c:simple-property name="aliases" displayName="aliases" default="" />
+ </resource-configuration>
+ </server>
+</plugin>
commit 4f2d4978464fa7fe0c173afafc38331733beddf0
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 9 22:08:38 2010 -0500
REading the file, parsing the file.
diff --git a/modules/plugins/nameservice-switch-plugin/pom.xml b/modules/plugins/nameservice-switch-plugin/pom.xml
index cba96c2..ec3a42f 100644
--- a/modules/plugins/nameservice-switch-plugin/pom.xml
+++ b/modules/plugins/nameservice-switch-plugin/pom.xml
@@ -8,7 +8,7 @@
<groupId>org.rhq.plugin.nss</groupId>
<artifactId>nameservices-switch-plugin</artifactId>
- <version>0.0.1</version>
+ <version>0.0.6</version>
<packaging>jar</packaging>
<name>Name Service Switch</name>
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
index 522d8e0..a1bd599 100644
--- a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
+++ b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -18,36 +18,28 @@
*/
package org.rhq.plugin.nss;
-import java.io.InputStream;
-import java.util.List;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.content.PackageType;
-import org.rhq.core.domain.content.transfer.DeployPackageStep;
-import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
-import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
-import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
-import org.rhq.core.pluginapi.content.ContentFacet;
-import org.rhq.core.pluginapi.content.ContentServices;
-import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
@@ -56,10 +48,14 @@ import org.rhq.core.pluginapi.operation.OperationResult;
*
* @author Adam Young
*/
-public class NameServiceSwitchComponent implements ResourceComponent, OperationFacet,
- ResourceConfigurationFacet {
+public class NameServiceSwitchComponent implements ResourceComponent<NameServiceSwitchComponent>, OperationFacet, ResourceConfigurationFacet {
+ private static final String ETC_NSSWITCH_CONF = "/tmp/nsswitch.conf";
+ //private static final String ETC_NSSWITCH_CONF = "/etc/nsswitch.conf";
+
private final Log log = LogFactory.getLog(NameServiceSwitchComponent.class);
+ private static Pattern linePattern = Pattern.compile("\\s*(\\p{Alpha}*):((?:\\s|\\p{Alpha}|\\[|\\]|\\=)*)");
+
/**
* Represents the resource configuration of the custom product being managed.
*/
@@ -103,7 +99,6 @@ public class NameServiceSwitchComponent implements ResourceComponent, OperationF
return AvailabilityType.UP;
}
-
/**
* The plugin container will call this method when it wants to invoke an operation on your managed resource. Your
* plugin will connect to the managed resource and invoke the analogous operation in your own custom way.
@@ -114,14 +109,56 @@ public class NameServiceSwitchComponent implements ResourceComponent, OperationF
return null;
}
+ static public String getContents(File aFile) {
+ //...checks on aFile are elided
+ StringBuilder contents = new StringBuilder();
+
+ try {
+ //use buffering, reading one line at a time
+ //FileReader always assumes default encoding is OK!
+ BufferedReader input = new BufferedReader(new FileReader(aFile));
+ try {
+ String line = null; //not declared within while loop
+ /*
+ * readLine is a bit quirky :
+ * it returns the content of a line MINUS the newline.
+ * it returns null only for the END of the stream.
+ * it returns an empty String if two newlines appear in a row.
+ */
+ while ((line = input.readLine()) != null) {
+ contents.append(line);
+ contents.append(System.getProperty("line.separator"));
+ }
+ } finally {
+ input.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+
+ return contents.toString();
+ }
+
public Set<RawConfiguration> loadRawConfigurations() {
- // TODO Auto-generated method stub
- return null;
+
+ Set<RawConfiguration> raws = new HashSet<RawConfiguration>();
+ RawConfiguration raw = new RawConfiguration();
+
+ raw.setPath(ETC_NSSWITCH_CONF);
+
+ raw.setContents(getContents(new File(raw.getPath())));
+
+ raws.add(raw);
+ return raws;
}
public Configuration loadStructuredConfiguration() {
- // TODO Auto-generated method stub
- return null;
+ Configuration configuration = new Configuration();
+ for (RawConfiguration raw : loadRawConfigurations()) {
+ mergeStructuredConfiguration(raw,configuration);
+ }
+
+ return configuration;
}
public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
@@ -130,27 +167,64 @@ public class NameServiceSwitchComponent implements ResourceComponent, OperationF
}
public void mergeStructuredConfiguration(RawConfiguration from, Configuration to) {
- // TODO Auto-generated method stub
+
+ ArrayList<Property> properties = new ArrayList<Property>();
+ to.addRawConfiguration(from);
+ try {
+ BufferedReader input = new BufferedReader(new StringReader(from.getContents()));
+ String line = null; //not declared within while loop
+ while ((line = input.readLine()) != null) {
+ Matcher matcher = linePattern.matcher(line);
+ if (matcher.matches()) {
+ properties.add(new PropertySimple(matcher.group(1), matcher.group(2).trim()));
+ }
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ to.setProperties(properties);
+
}
public void persistRawConfiguration(RawConfiguration rawConfiguration) {
- // TODO Auto-generated method stub
+
+
}
public void persistStructuredConfiguration(Configuration configuration) {
// TODO Auto-generated method stub
-
+
}
public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
// TODO Auto-generated method stub
-
+
}
public void validateStructuredConfiguration(Configuration configuration) {
// TODO Auto-generated method stub
+
+ }
+
+
+ public static void main(String[] args){
+ String noMatch = "# abcd: val";
+ String yesMatch = "bootparams: nisplus [NOTFOUND=return] files";
+
+ Matcher matcher = linePattern.matcher(noMatch);
+ if (matcher.matches()) {
+ System.exit(1);
+ }
+ matcher = linePattern.matcher(yesMatch);
+
+
+ if (matcher.matches()){
+ System.out.println("Group0="+matcher.group(1));
+ System.out.println("Group1="+matcher.group(2).trim());
+ }
+
}
}
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
index cad370b..305129e 100644
--- a/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
@@ -13,7 +13,21 @@
class="NameServiceSwitchComponent"
description="Name Service Switch Component">
<resource-configuration configurationFormat="both">
- <c:simple-property name="paswd" displayName="passwd" default="files" />
+ <c:simple-property name="passwd" displayName="passwd" default="" />
+ <c:simple-property name="shadow" displayName="shadow" default="" />
+ <c:simple-property name="group" displayName="group" default="" />
+ <c:simple-property name="hosts" displayName="hosts" default="" />
+ <c:simple-property name="bootparams" displayName="bootparams" default="" />
+ <c:simple-property name="ethers" displayName="ethers" default="" />
+ <c:simple-property name="netmasks" displayName="netmasks" default="" />
+ <c:simple-property name="networks" displayName="networks" default="" />
+ <c:simple-property name="protocols" displayName="protocols" default="" />
+ <c:simple-property name="rpc" displayName="rpc" default="" />
+ <c:simple-property name="services" displayName="services" default="" />
+ <c:simple-property name="netgroup" displayName="netgroup" default="" />
+ <c:simple-property name="publickey" displayName="publickey" default="" />
+ <c:simple-property name="automount" displayName="automount" default="" />
+ <c:simple-property name="aliases" displayName="aliases" default="" />
</resource-configuration>
</server>
</plugin>
commit f4a55e5af12c0f54b56c8eef60dd48d0de60d0a5
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 9 20:01:43 2010 -0500
Initiali check in of Name Server Switch COmponent, a simple file based resource that supports both Raw and Structured configuration
diff --git a/.classpath b/.classpath
index 5746d68..64df586 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/nameservice-switch-plugin/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/jboss-software/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/client-api/src/main/java"/>
diff --git a/modules/plugins/nameservice-switch-plugin/pom.xml b/modules/plugins/nameservice-switch-plugin/pom.xml
new file mode 100644
index 0000000..cba96c2
--- /dev/null
+++ b/modules/plugins/nameservice-switch-plugin/pom.xml
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq.plugin.nss</groupId>
+ <artifactId>nameservices-switch-plugin</artifactId>
+ <version>0.0.1</version>
+ <packaging>jar</packaging>
+
+ <name>Name Service Switch</name>
+ <description>A Plugin for managing the Name Service Switch infrastructure of a Linux System</description>
+
+ <properties>
+ <rhq.version>1.4.0-SNAPSHOT</rhq.version>
+ </properties>
+
+ <dependencies>
+
+ <!-- Below are the core modules that are required dependencies of all plugins -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>hibernate-annotations</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.2.1.GA</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!--
+ Uncomment the one of the three logging systems your plugin uses: log4j, commons-logging or i18nlog
+ All three are provided to your plugin by the agent/plugin-container.
+ -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Define any third-party dependencies your plugin has here. -->
+ <!--
+ <dependency>
+ <groupId>group-id-of-dependency-goes-here</groupId>
+ <artifactId>artifact-id-of-dependency-goes-here</artifactId>
+ <version>version-of-dependency-goes-here</version>
+ </dependency>
+ -->
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-plugin-validator</artifactId>
+ <version>${rhq.version}</version>
+ </plugin>
+
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>dev</id>
+ <properties>
+ <rhq.rootDir>../../..</rhq.rootDir>
+ <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}"
+ manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss</id>
+ <name>JBoss Plugin Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/modules/plugins/nameservice-switch-plugin/pom.xml~ b/modules/plugins/nameservice-switch-plugin/pom.xml~
new file mode 100644
index 0000000..517ccf4
--- /dev/null
+++ b/modules/plugins/nameservice-switch-plugin/pom.xml~
@@ -0,0 +1,255 @@
+<?xml version="1.0"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq.sample.skeletonplugin</groupId>
+ <artifactId>skeleton-plugin</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>Skeleton RHQ Plugin Template</name>
+ <description>A template for building a custom RHQ agent plugin</description>
+
+ <properties>
+ <rhq.version>1.4.0-SNAPSHOT</rhq.version>
+ </properties>
+
+ <dependencies>
+
+ <!-- Below are the core modules that are required dependencies of all plugins -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${rhq.version}</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>hibernate-annotations</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.2.1.GA</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!-- Fix for the Javac bug requiring annotations to be available when compiling classes. (fixed in JDK 6) -->
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope> <!-- provided by the agent/plugin-container -->
+ </dependency>
+
+ <!--
+ Uncomment the one of the three logging systems your plugin uses: log4j, commons-logging or i18nlog
+ All three are provided to your plugin by the agent/plugin-container.
+ -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>provided</scope>
+ </dependency>
+ -->
+
+ <!--
+ <dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ <version>1.0.9</version>
+ <scope>provided</scope>
+ </dependency>
+ -->
+
+ <!-- Define any third-party dependencies your plugin has here. -->
+ <!--
+ <dependency>
+ <groupId>group-id-of-dependency-goes-here</groupId>
+ <artifactId>artifact-id-of-dependency-goes-here</artifactId>
+ <version>version-of-dependency-goes-here</version>
+ </dependency>
+ -->
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-plugin-validator</artifactId>
+ <version>${rhq.version}</version>
+ </plugin>
+
+ <!--
+ If your plugin has third-party jar dependencies that are not already available when deployed in the plugin
+ container, you can package these jars in your plugin. They go in your plugin jar's "lib" directory.
+ Uncomment the maven plugin definition below and define one or more jar files (aka "artifactItem" elements)
+ that you want to include in your plugin jar.
+ -->
+ <!--
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>your-third-party-dep-group</groupId>
+ <artifactId>your-third-party-dep-artifact</artifactId>
+ <version>your-third-party-dep-version</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>dev</id>
+ <properties>
+ <!-- define the location of your RHQ root directory - typically rhq.rootDir is overridden in Maven's settings.xml -->
+ <rhq.rootDir>/rhq/trunk</rhq.rootDir>
+ <rhq.defaultDevContainerPath>dev-container</rhq.defaultDevContainerPath>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins</rhq.deploymentDir>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}"
+ manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss</id>
+ <name>JBoss Plugin Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
new file mode 100644
index 0000000..522d8e0
--- /dev/null
+++ b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchComponent.java
@@ -0,0 +1,156 @@
+/*
+ * 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.plugin.nss;
+
+import java.io.InputStream;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+/**
+ * Allows the RHQ server to manage the Name Server Switch Configuration for a Linux Platform
+ *
+ * @author Adam Young
+ */
+public class NameServiceSwitchComponent implements ResourceComponent, OperationFacet,
+ ResourceConfigurationFacet {
+ private final Log log = LogFactory.getLog(NameServiceSwitchComponent.class);
+
+ /**
+ * Represents the resource configuration of the custom product being managed.
+ */
+ private Configuration resourceConfiguration;
+
+ /**
+ * All AMPS plugins are stateful - this context contains information that your resource component can use when
+ * performing its processing.
+ */
+ private ResourceContext resourceContext;
+
+ /**
+ * This is called when your component has been started with the given context. You normally initialize some internal
+ * state of your component as well as attempt to make a stateful connection to your managed resource.
+ *
+ * @see ResourceComponent#start(ResourceContext)
+ */
+ public void start(ResourceContext context) {
+ resourceContext = context;
+ }
+
+ /**
+ * This is called when the component is being stopped, usually due to the plugin container shutting down. You can
+ * perform some cleanup here; though normally not much needs to be done here.
+ *
+ * @see ResourceComponent#stop()
+ */
+ public void stop() {
+ }
+
+ /**
+ * All resource components must be able to tell the plugin container if the managed resource is available or not.
+ * This method is called by the plugin container when it needs to know if the managed resource is actually up and
+ * available.
+ *
+ * @see ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+ // TODO: here you normally make some type of connection attempt to the managed resource
+ // to determine if it is really up and running.
+ return AvailabilityType.UP;
+ }
+
+
+ /**
+ * The plugin container will call this method when it wants to invoke an operation on your managed resource. Your
+ * plugin will connect to the managed resource and invoke the analogous operation in your own custom way.
+ *
+ * @see OperationFacet#invokeOperation(String, Configuration)
+ */
+ public OperationResult invokeOperation(String name, Configuration configuration) {
+ return null;
+ }
+
+ public Set<RawConfiguration> loadRawConfigurations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Configuration loadStructuredConfiguration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void mergeStructuredConfiguration(RawConfiguration from, Configuration to) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void persistRawConfiguration(RawConfiguration rawConfiguration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void persistStructuredConfiguration(Configuration configuration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void validateStructuredConfiguration(Configuration configuration) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
new file mode 100644
index 0000000..e0d1958
--- /dev/null
+++ b/modules/plugins/nameservice-switch-plugin/src/main/java/org/rhq/plugin/nss/NameServiceSwitchDiscoveryComponent.java
@@ -0,0 +1,83 @@
+/*
+ * 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.plugin.nss;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ProcessScanResult;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+
+/**
+ *
+ *Discovers if the Linux platform is using NSSWitch
+ * @author Adam Young
+ */
+public class NameServiceSwitchDiscoveryComponent implements ResourceDiscoveryComponent<NameServiceSwitchComponent> {
+ private final Log log = LogFactory.getLog(NameServiceSwitchDiscoveryComponent.class);
+
+ /**
+ * Review the javadoc for both {@link ResourceDiscoveryComponent} and {@link ResourceDiscoveryContext} to learn what
+ * you need to do in this method.
+ *
+ * @see ResourceDiscoveryComponent#discoverResources(ResourceDiscoveryContext)
+ */
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext context) {
+ log.info("Calling discoverResources for NSS");
+
+ // if your plugin descriptor defined one or more <process-scan>s, then see if the plugin container
+ // auto-discovered processes using those process scan definitions. Process all those that were found.
+ List<ProcessScanResult> autoDiscoveryResults = context.getAutoDiscoveredProcesses();
+ for (ProcessScanResult autoDiscoveryResult : autoDiscoveryResults) {
+ // determine if you want to include the result in this method's returned set of discovered resources
+ }
+
+ List<Configuration> pluginConfigs = context.getPluginConfigurations();
+ for (Configuration pluginConfig : pluginConfigs) {
+ // pluginConfig contains information on a resource that was manually discovered/entered by the user
+ // take it and build a details object that represents that resource
+ }
+
+ // now perform your own discovery mechanism, if you have one. For each resource discovered, you need to
+ // create a details object that describe the resource that you discovered.
+ HashSet<DiscoveredResourceDetails> set = new HashSet<DiscoveredResourceDetails>();
+
+ // key = this must be a unique string across all of your resources - see docs for uniqueness rules
+ // name = this is the name you give the new resource; it does not necessarily have to be unique
+ // version = this is any string that corresponds to the resource's version
+ // description = this is any string that you want to assign as the default description for your resource
+ String key = "NSSwitch";
+ String name = "NSSwitch";
+ String version = "0.0.2";
+ String description = "Name Service Switch Infrastructure";
+
+ DiscoveredResourceDetails resource = new DiscoveredResourceDetails(context.getResourceType(), key, name,
+ version, description, null, null);
+
+ set.add(resource);
+
+ return set;
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
new file mode 100644
index 0000000..cad370b
--- /dev/null
+++ b/modules/plugins/nameservice-switch-plugin/src/main/resources/META-INF/rhq-plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<plugin name=""
+ displayName="Name Service Switch"
+ version="1.0"
+ package="org.rhq.plugin.nss"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <server name="Name Server Switch"
+ discovery="NameServiceSwitchDiscoveryComponent"
+ class="NameServiceSwitchComponent"
+ description="Name Service Switch Component">
+ <resource-configuration configurationFormat="both">
+ <c:simple-property name="paswd" displayName="passwd" default="files" />
+ </resource-configuration>
+ </server>
+</plugin>
commit 5443a982e445d786a9cfbfee475f9d8cb59cbf17
Merge: d6b4d2e... 3396e7a...
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Feb 12 13:04:09 2010 -0500
Merge branch 'master' into linux-config
commit 3396e7a21b3274887f86d175d5bfd36ad78c175a
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Feb 12 13:01:38 2010 -0500
Fix for Jira RF-8359
Wrapped the upload widget to the same form. RF 3.3.2 seems to require the upload widget
to be inside a h:form
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
index fb60605..415e4c1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/admin/plugin/plugin-list.xhtml
@@ -260,7 +260,6 @@
</h:panelGrid>
</rich:panel>
-</h:form>
<rich:panel>
<f:facet name="header">
@@ -282,7 +281,7 @@
</h:panelGrid>
</rich:panel>
-
+</h:form>
</ui:define>
</ui:composition>
commit 7a79d01574153b41e7e6375eae1a1b25824f8afc
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 12:34:14 2010 -0500
Adding file display name property in RawConfigUIBean so file name is not lost in download
The fileName property was modified in a previous commit to prepend an asterisk to the name
when the file has modifications. This was done to be more consistent with the mock-ups from
UXD. That change however resulted in the file name for a download request to show up as
only an asterisk because the download method was using that same property. That property
now just returns the file name, minus the path, and there is a new property, fileDisplayName
which has the logic for prepending the asterisk.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index e7c4733..dd25ded 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -76,16 +76,21 @@ public class RawConfigUIBean {
}
/** @return The name of the raw config file excluding its path */
- // Note: In the mock-up an asterisk is prepended to the file name in the menu to indicate that it has modifications.
- // We may want to modify this method to include logic for that as the UI evolves. If so, it might also be
- // good to change the method name to something a bit more descriptive like getFileNameLabel().
public String getFileName() {
File file = new File(rawConfiguration.getPath());
+ return file.getName();
+ }
+ /**
+ * @return The name of the raw config file excluding the path. If the file has been modified, an asterisk is
+ * prepended to the name.
+ */
+ public String getFileDisplayName() {
if (isModified()) {
- return "* " + file.getName();
+ return "* " + getFileName();
}
- return file.getName();
+
+ return getFileName();
}
public String getIcon() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 1ffb047..4f69bef 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -43,11 +43,11 @@
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{selectedRawUIBean.fileName}">
+ selectedChild="#{selectedRawUIBean.fileDisplayName}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<c:choose>
<c:when test="#{readOnly}">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
+ <rich:panelMenuItem label="#{rawConfigUIBean.fileDisplayName}"
icon="/images/blank.png"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
@@ -59,7 +59,7 @@
<rich:panelMenuItem label=""
icon="/images/blank.png">
<h:panelGrid columns="2" columnClasses="rawConfigFileNameCol,rawConfigUndoCol">
- <h:outputLabel value="#{rawConfigUIBean.fileName}">
+ <h:outputLabel value="#{rawConfigUIBean.fileDisplayName}">
<a4j:support event="onmousedown"
onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
commit 4797b6dcb545c245ef0477d023b92e83198d0163
Author: John Sanda <john(a)localhost.localdomain>
Date: Fri Feb 12 12:19:44 2010 -0500
Adding cancel button that takes you back to view.xhtml and does away with any uncommitted edits
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
index 2676d48..01af8ab 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
@@ -148,6 +148,18 @@
text-decoration: none
}
+.rawCancelButton {
+ font-size: 11px;
+ font-weight: bold;
+ color: #E6E8ED;
+ background-color: #828CA3;
+ border: 1px outset #626C83;
+ padding: 1px 10px;
+ cursor: pointer;
+ text-decoration: none;
+ margin-left: 5px;
+}
+
.rawConfigFileNameCol {
color: rgb(109, 120, 124);
font-family: sans-serif;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ab51327..2f82d89 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -60,7 +60,7 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup id="upperCommitPanel" style="text-align:right">
+ <h:panelGroup id="upperCommitPanel" style="text-align:right;">
<h:outputText id="upperChangedFilesLabel"
rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"
@@ -70,6 +70,14 @@ THIS TEXT WILL BE REMOVED.
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
+ <s:button id="upperCancelButton"
+ value="Cancel"
+ view="view.xhtml"
+ styleClass="rawCancelButton"
+ propagation="end">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationEditor.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
@@ -144,6 +152,14 @@ THIS TEXT WILL BE REMOVED.
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
+ <s:button id="lowerCancelButton"
+ value="Cancel"
+ view="view.xhtml"
+ styleClass="rawCancelButton"
+ propagation="end">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationEditor.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml
new file mode 100644
index 0000000..1fd1afd
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/error-window.xhtml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <rich:modalPanel id="errorWindow" width="800" height="600">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="Errors"/>
+ </h:panelGroup>
+ </f:facet>
+
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/close.png" styleClass="hidelink" id="hideErrorWindowLink"/>
+ <rich:componentControl for="errorWindow" attachTo="hideErrorWindowLink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+
+ <rich:tabPanel switchType="client">
+ <rich:tab label="Raw 1">
+ <h:inputTextarea
+ styleClass="rawConfigFileContents"
+ style="width:100%; height:100%; overflow:visible; border-width:0px"
+ rows="30"
+ cols="30"
+ value="FOO"
+ readonly="true"/>
+ </rich:tab>
+ <rich:tab label="Raw 2">
+ <h:inputTextarea
+ styleClass="rawConfigFileContents"
+ style="width:100%; height:100%; overflow:visible; border-width:0px"
+ rows="30"
+ cols="30"
+ value="FOO"
+ readonly="true"/>
+ </rich:tab>
+ </rich:tabPanel>
+
+ <h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
+ <h:panelGroup style="text-align:right">
+ <a4j:commandButton value="Cancel" onclick="#{rich:component('errorWindow')}.hide()" styleClass="buttonmed"/>
+ </h:panelGroup>
+ </h:panelGrid>
+ </rich:modalPanel>
+
+</ui:composition>
\ No newline at end of file
commit a72f8346ec477d3c4015fb48ec8f87d1f6723d81
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 12 11:46:56 2010 -0500
the installer should create a keystore with the server's public endpoint in the CN
this is BZ 564409
diff --git a/modules/enterprise/gui/installer-war/pom.xml b/modules/enterprise/gui/installer-war/pom.xml
index 3481a24..6c9121b 100644
--- a/modules/enterprise/gui/installer-war/pom.xml
+++ b/modules/enterprise/gui/installer-war/pom.xml
@@ -57,6 +57,13 @@
</dependency>
<dependency>
+ <!-- need this solely for SecurityUtils -->
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-comm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.6.5</version>
diff --git a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
index 90f4072..bca6381 100644
--- a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
+++ b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ConfigurationBean.java
@@ -722,6 +722,9 @@ public class ConfigurationBean {
// Ensure the install server info is up to date and stored in the DB
serverInfo.storeServer(configurationAsProperties, haServer);
+ // build a keystore whose cert has a CN of this server's public endpoint address
+ serverInfo.createKeystore(haServer);
+
// now deploy RHQ Server fully
serverInfo.moveDeploymentArtifacts(true);
} catch (Exception e) {
diff --git a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ServerInformation.java b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ServerInformation.java
index f90c526..0896ace 100644
--- a/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ServerInformation.java
+++ b/modules/enterprise/gui/installer-war/src/main/java/org/rhq/enterprise/installer/ServerInformation.java
@@ -61,6 +61,7 @@ import org.rhq.core.db.SQLServerDatabaseType;
import org.rhq.core.db.setup.DBSetup;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.core.util.jdbc.JDBCUtil;
+import org.rhq.enterprise.communications.util.SecurityUtil;
/**
* Finds out information about the RHQ Server and the JBossAS server it is running in. It can also be used to modify
@@ -97,6 +98,7 @@ public class ServerInformation {
private File binDirectory = null;
private File logDirectory = null;
private File dataDirectory = null;
+ private File confDirectory = null;
public ServerInformation() {
// This is called both within the context of the GUI and the auto-install startup servlet.
@@ -565,6 +567,18 @@ public class ServerInformation {
return dataDirectory;
}
+ private File getConfDirectory() {
+ if (confDirectory == null) {
+ MBeanServer mbs = getMBeanServer();
+ ObjectName name = ObjectNameFactory.create("jboss.system:type=ServerConfig");
+ Object mbean = MBeanServerInvocationHandler.newProxyInstance(mbs, name, ServerConfig.class, false);
+
+ confDirectory = new File(((ServerConfig) mbean).getServerHomeDir(), "conf");
+ }
+
+ return confDirectory;
+ }
+
private MBeanServer getMBeanServer() {
if (mbeanServer == null) {
mbeanServer = MBeanServerLocator.locateJBoss();
@@ -1230,4 +1244,40 @@ public class ServerInformation {
}
}
+ public void createKeystore(Server haServer) {
+ File confDir = getConfDirectory();
+ File keystore = new File(confDir, "rhq.keystore");
+ File keystoreBackup = new File(confDir, "rhq.keystore.backup");
+
+ // if there is one out-of-box, we want to remove it and create one with our proper CN
+ if (keystore.exists()) {
+ keystoreBackup.delete();
+ if (!keystore.renameTo(keystoreBackup)) {
+ LOG.warn("Cannot backup existing keystore - cannot generate a new cert with a proper domain name. ["
+ + keystore + "] will be the keystore used by this server");
+ return;
+ }
+ }
+
+ try {
+ String keystorePath = keystore.getAbsolutePath();
+ String keyAlias = "RHQ";
+ String domainName = "CN=" + haServer.endpointAddress + ", OU=RHQ, O=rhq-project.org, C=US";
+ String keystorePassword = "RHQManagement";
+ String keyPassword = keystorePassword;
+ String keyAlgorithm = "rsa";
+ int validity = 7300;
+ SecurityUtil.createKeyStore(keystorePath, keyAlias, domainName, keystorePassword, keyPassword,
+ keyAlgorithm, validity);
+ LOG.info("New keystore created [" + keystorePath + "] with cert domain name of [" + domainName + "]");
+ } catch (Exception e) {
+ LOG.warn("Could not generate a new cert with a proper domain name, will use the original keystore");
+ keystore.delete();
+ if (!keystoreBackup.renameTo(keystore)) {
+ LOG.warn("Failed to restore the original keystore from backup - please rename [" + keystoreBackup
+ + "] to [" + keystore + "]");
+ }
+ }
+ }
+
}
\ No newline at end of file
commit da94b7a08f7878d58ab68b5aca7acda86e812059
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 12 10:42:27 2010 -0500
opps.. this sample plugin has been deleted, remove from eclipse classpath
diff --git a/.classpath b/.classpath
index 8c4665b..e9a098f 100644
--- a/.classpath
+++ b/.classpath
@@ -128,7 +128,6 @@
<classpathentry kind="src" path="modules/helpers/pluginAnnotations/src/main/java"/>
<classpathentry kind="src" path="modules/helpers/pluginGen/src/main/java"/>
<classpathentry kind="src" path="etc/samples/skeleton-plugin/src/main/java"/>
- <classpathentry kind="src" path="etc/samples/custom-bundle-plugin/src/main/java"/>
<classpathentry kind="src" path="etc/samples/custom-serverplugin/src/main/java"/>
<classpathentry kind="src" path="etc/samples/simplereport-serverplugin/src/main/java"/>
<classpathentry kind="src" path="etc/agentspawn/src/main/java"/>
commit 1537c05d7cfa47031d3f5a9fad6925c72d988e6f
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 21:53:25 2010 -0500
Modifying logic for determining whether or not to render the upload window
The logic was in part looking at the value of the field, mode, which gets updated when the
user changes tabs. The problem is though that that field is updated after its value is needed.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 239dd65..801f9a4 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -23,12 +23,9 @@
package org.rhq.enterprise.gui.configuration.resource;
-import org.apache.commons.io.FileUtils;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
@@ -36,15 +33,10 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
-import org.rhq.enterprise.gui.inventory.resource.ResourceUIBean;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.richfaces.model.UploadItem;
-
import javax.faces.application.FacesMessage;
-import java.io.IOException;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@@ -147,7 +139,7 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
}
public boolean getRenderFileUpload() {
- return isRawMode() && (isRawSupported() || isStructuredAndRawSupported());
+ return isRawSupported() || isStructuredAndRawSupported();
}
public String updateConfiguration() {
commit 5eb11fb2ab46203db77721c3d5ba3dd7f9316079
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 16:09:37 2010 -0500
Refactoring ResourceConfigurationViewer to handle a null resource config def and/or null config
When the viewer initializes it attempts to load the resource configuration definition and
resource configuration. If the definition is null, then that means that the resource does
not support configuration. If the configuration is null, it is assumed that the configuration
has not yet been initialized. This might happen for instance if the agent is down.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index 470ce8b..d146afa 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -39,6 +39,7 @@ import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import javax.faces.application.FacesMessage;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
@@ -58,13 +59,13 @@ public class ResourceConfigurationViewer {
@In("webUser")
protected WebUser loggedInUser;
- @Out
+ @Out(required = false)
protected Configuration resourceConfiguration;
- @Out
+ @Out(required = false)
protected ConfigurationDefinition resourceConfigurationDefinition;
- @Out
+ @Out(required = false)
private Collection<RawConfigDirectory> rawConfigDirectories;
@Out(required = false)
@@ -72,20 +73,45 @@ public class ResourceConfigurationViewer {
protected Integer resourceId;
+ protected boolean initialized = false;
+
/**
+ * <p>
* This method "bootstraps" the viewer/editor and the model objects used in the view. Specifically, the resource
* configuration and the corresponding configuration definition are loaded from the database and are outjected for
* use in the view.
+ * </p>
+ * <p>
+ * If the configuration definition or if the configuration fail to load for whatever reason, the initialized flag
+ * is set to <code>false</code>. When the configuration definition is null a message is added to the Faces context
+ * indicating that the resource does not expose a configuration. When the configuration is null, a message is added
+ * to the Faces context indicating that the resource configuration has not been initialized.
+ * </p>
*/
- @Create
public void initialize() {
resourceId = FacesContextUtility.getRequiredRequestParameter("id", Integer.class);
loadResourceConfigurationDefinition();
+
+ if (resourceConfigurationDefinition == null) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
+ "This resource does not expose a configuration.");
+ return;
+ }
+
loadResourceConfiguration();
+
+ if (resourceConfiguration == null) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
+ "This resource's configuration has not yet been initialized.");
+ return;
+ }
+
initRawConfigDirectories();
initMode();
+ initialized = true;
+
doInitialization();
}
@@ -169,6 +195,10 @@ public class ResourceConfigurationViewer {
}
}
+ public boolean isInitialized() {
+ return initialized;
+ }
+
/** @return <code>true</code> if the resource configuration supports raw only, <code>false</code> otherwise */
public boolean isRawSupported() {
return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.RAW;
@@ -262,6 +292,10 @@ public class ResourceConfigurationViewer {
}
public boolean isUpdateInProgress() {
+ if (!isInitialized()) {
+ return false;
+ }
+
ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
return configurationMgr.isResourceConfigurationUpdateInProgress(loggedInUser.getSubject(), resourceId);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 4d7d4c2..5948355 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -6,6 +6,7 @@
<page view-id="/rhq/resource/configuration/view.xhtml">
<action execute="#{configurationViewer.initialize}" on-postback="false"/>
+
<navigation from-action="#{ConfigHelperUIBean.accessMap}">
<redirect view-id="/rhq/resource/configuration/view-map.xhtml">
<param name="id" value="#{ResourceUIBean.id}"/>
@@ -23,7 +24,10 @@
if="#{!conversation.longRunning or (empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id)}"/>
<navigation from-action="#{configurationEditor.initialize}">
- <begin-conversation join="true"/>
+ <rule if="#{configurationEditor.initialized}">
+ <begin-conversation join="true"/>
+ </rule>
+
<rule if="#{configurationEditor.updateInProgress}">
<redirect view-id="/rhq/resource/configuration/view.xhtml" include-page-params="true">
<param name="id" value="#{ResourceUIBean.id}"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index f5be7d0..ab51327 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -47,9 +47,14 @@ THIS TEXT WILL BE REMOVED.
}
</script>
+ <h:panelGroup layout="block" styleClass="InfoBlock"
+ rendered="#{configurationEditor.updateInProgress}">
+ <b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
+ </h:panelGroup>
+
<h:form id="editResourceConfigurationForm"
onsubmit="prepareInputsForSubmission(this)"
- rendered="#{!configurationEditor.updateInProgress}">
+ rendered="#{configurationEditor.initialized}">
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
@@ -151,12 +156,7 @@ THIS TEXT WILL BE REMOVED.
upload-modal.xhtml needs to be included outside the above form because the file upload component requires its
own, separate form.
-->
- <ui:include src="upload-modal.xhtml"/>
-
- <h:panelGroup layout="block" styleClass="InfoBlock"
- rendered="#{configurationEditor.updateInProgress}">
- <b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
- </h:panelGroup>
+ <ui:include src="upload-modal.xhtml"/>
</ui:define>
</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index e50c592..6541456 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -42,7 +42,7 @@ THIS TEXT WILL BE REMOVED.
<b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
</h:panelGroup>
- <h:form id="viewResourceConfigurationForm">
+ <h:form id="viewResourceConfigurationForm" rendered="#{configurationViewer.initialized}">
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
<h:panelGrid columns="2" style="width:100%">
@@ -116,13 +116,6 @@ THIS TEXT WILL BE REMOVED.
<ui:include src="view-raw-modal.xhtml"/>
</h:form>
-
- <h:panelGroup layout="block" styleClass="InfoBlock"
- rendered="#{configurationViewer.updateInProgress}">
- <b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
- </h:panelGroup>
-
-
</ui:define>
</ui:composition>
commit 6fb4ab4d942f0efe17ab874daa16af092dca940b
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 13:50:21 2010 -0500
Updating page navigation rules for validation failures
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 9fcc673..4d7d4c2 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -32,6 +32,7 @@
</navigation>
<navigation from-action="#{configurationEditor.updateConfiguration}">
+ <!-- success out is used for both success and in progress update statuses -->
<rule if-outcome="success">
<end-conversation before-redirect="false"/>
<redirect view-id="/rhq/resource/configuration/history.xhtml">
@@ -39,7 +40,7 @@
</redirect>
</rule>
- <rule if-outcome="nochange">
+ <rule if-outcome="#{nochange or failure}">
<render view-id="/rhq/resource/configuration/edit.xhtml"/>
</rule>
</navigation>
commit 74487e8942a9887332fb5150b2f2a40c4472ad52
Merge: 378a336... d80bb12...
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 11 13:49:12 2010 -0500
Merge branch 'master' into search
commit 378a33623dfe393824d3c111f7e88854047097b1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 11 13:47:55 2010 -0500
fix broken links after an AJAX-refresh:
* directly AJAX-reload the tabBar, not a containing outputPanel
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/layout/main.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/layout/main.xhtml
index 91d21df..1f25f25 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/layout/main.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/inventory/layout/main.xhtml
@@ -28,8 +28,8 @@
</h:form>
</a4j:region>
- <a4j:outputPanel id="browserTabBarPanel" style="width: 100%;">
- <onc:tabBar selectedTabName="#{selectedTabName}" >
+
+ <onc:tabBar id="browserTabBarPanel" selectedTabName="#{selectedTabName}" >
<onc:tab name="Resources"
displayName="Resources #{InventorySummaryUIBean.resourceCount}"
url="/rhq/inventory/browseResources.xhtml?subtab=all">
@@ -65,7 +65,7 @@
url="/rhq/definition/group/list.xhtml" />
</onc:tab>
</onc:tabBar>
- </a4j:outputPanel>
+
<p />
<h:messages showSummary="true"
commit d2e3544075a46a40ea0bdf7226396ad41590099f
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Feb 11 13:43:37 2010 -0500
support displaying empty groups in the new inventory browser properly:
* use object wrappers for composite object constructors, otherwise hibernate constructor query bombs;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
index d4dbca8..a5bd861 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupComposite.java
@@ -63,28 +63,33 @@ public class ResourceGroupComposite implements Serializable {
private ResourceGroupComposite() {
}
- public ResourceGroupComposite(long explicitCount, double explicitAvailability, long implicitCount,
- double implicitAvailability, ResourceGroup resourceGroup) {
+ public ResourceGroupComposite(Long explicitCount, Double explicitAvailability, Long implicitCount,
+ Double implicitAvailability, ResourceGroup resourceGroup) {
this(explicitCount, explicitAvailability, implicitCount, implicitAvailability, resourceGroup, null);
}
- public ResourceGroupComposite(long explicitCount, double explicitAvailability, long implicitCount,
- double implicitAvailability, ResourceGroup resourceGroup, ResourceFacets facets) {
+ public ResourceGroupComposite(Long explicitCount, Double explicitAvailability, Long implicitCount,
+ Double implicitAvailability, ResourceGroup resourceGroup, ResourceFacets facets) {
- explicitUp = Math.round(explicitCount * explicitAvailability);
- explicitDown = explicitCount - explicitUp;
+ long expCount = (explicitCount == null ? 0 : explicitCount);
+ double expAvail = (explicitAvailability == null ? 0 : explicitAvailability);
+ long impCount = (implicitCount == null ? 0 : implicitCount);
+ double impAvail = (implicitAvailability == null ? 0 : implicitAvailability);
+
+ explicitUp = Math.round(expCount * expAvail);
+ explicitDown = expCount - explicitUp;
if (explicitUp + explicitDown > 0) {
// keep explicitAvail null if there are no explicit resources in the group
- explicitAvail = explicitAvailability;
+ explicitAvail = expAvail;
} else {
explicitAvail = null;
}
- implicitUp = Math.round(implicitCount * implicitAvailability);
- implicitDown = implicitCount - implicitUp;
+ implicitUp = Math.round(impCount * impAvail);
+ implicitDown = impCount - implicitUp;
if (implicitUp + implicitDown > 0) {
// keep implicitAvail null if there are no implicit resources in the group
- implicitAvail = implicitAvailability;
+ implicitAvail = impAvail;
} else {
implicitAvail = null;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
index 1eb3cec..4bfe7fb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerBean.java
@@ -967,10 +967,10 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
String replacementSelectList = ""
+ " new org.rhq.core.domain.resource.group.composite.ResourceGroupComposite( "
- + " ( SELECT COUNT(avail) FROM rg.explicitResources res JOIN res.currentAvailability avail) AS explicitCount,"
- + " ( SELECT AVG(avail.availabilityType) FROM rg.explicitResources res JOIN res.currentAvailability avail) AS explicitAvail,"
- + " ( SELECT COUNT(avail) FROM rg.implicitResources res JOIN res.currentAvailability avail) AS implicitCount,"
- + " ( SELECT AVG(avail.availabilityType) FROM rg.implicitResources res JOIN res.currentAvailability avail) AS implicitAvail,"
+ + " ( SELECT COUNT(avail) FROM rg.explicitResources res JOIN res.currentAvailability avail ) AS explicitCount,"
+ + " ( SELECT AVG(avail.availabilityType) FROM rg.explicitResources res JOIN res.currentAvailability avail ) AS explicitAvail,"
+ + " ( SELECT COUNT(avail) FROM rg.implicitResources res JOIN res.currentAvailability avail ) AS implicitCount,"
+ + " ( SELECT AVG(avail.availabilityType) FROM rg.implicitResources res JOIN res.currentAvailability avail ) AS implicitAvail,"
+ " rg ) ";
generator.alterProjection(replacementSelectList);
@@ -1305,7 +1305,7 @@ public class ResourceGroupManagerBean implements ResourceGroupManagerLocal, Reso
((Number) data[3]).doubleValue(), //
group, facets);
} else {
- composite = new ResourceGroupComposite(0, 0, 0, 0, group, facets);
+ composite = new ResourceGroupComposite(0L, 0.0, 0L, 0.0, group, facets);
}
group.getModifiedBy().getFirstName();
commit 48a1afdb2049636f5792f286e791016ff410423f
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 13:22:42 2010 -0500
Updating page navigation rules for when there is no change on an update request
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 77c9525..239dd65 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -177,13 +177,23 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
return "failure";
case NOCHANGE:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
- + "no update request has been sent to the Agent.");
- return "success";
+ addNoChangeMsgToFacesContext();
+ return "nochange";
}
}
- return null;
+ // updateRequest will be null if there is no change to the configuration. ConfigurationManagerBean checks to
+ // see if the configuration has been modified before sending the request to the agent. If no change is detected,
+ // it simply returns null.
+
+ addNoChangeMsgToFacesContext();
+
+ return "nochange";
+ }
+
+ private void addNoChangeMsgToFacesContext() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
+ + "no update request has been sent to the Agent.");
}
public void undoEdit(String path) {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 43331bf..9fcc673 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -38,6 +38,10 @@
<param name="id" value="#{ResourceUIBean.id}"/>
</redirect>
</rule>
+
+ <rule if-outcome="nochange">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </rule>
</navigation>
<navigation from-action="#{configurationEditor.finishAddMap}">
commit d6b4d2ef6f11f3e33914eb8e8b8ee66ae7a59d73
Merge: 777fd10... d80bb12...
Author: Partha Aji <paji(a)redhat.com>
Date: Thu Feb 11 10:56:15 2010 -0500
Merge branch 'master' into linux-config
commit 51093286c0028554b74c3f267681ca45e92c38a3
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 10:55:36 2010 -0500
Doing away with the bright, fancy star used to inidicate file changes
Replacing the star icon with an asterisk to be more consistent with the mock-ups from UXD.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 2e430bb..e7c4733 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -81,6 +81,10 @@ public class RawConfigUIBean {
// good to change the method name to something a bit more descriptive like getFileNameLabel().
public String getFileName() {
File file = new File(rawConfiguration.getPath());
+
+ if (isModified()) {
+ return "* " + file.getName();
+ }
return file.getName();
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index a1d3c35..470ce8b 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -121,7 +121,7 @@ public class ResourceConfigurationViewer {
initConfigDirectories();
}
else {
- rawConfigDirectories = Collections.EMPTY_LIST;
+ rawConfigDirectories = Collections.emptyList();
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 0e1d31d..1ffb047 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -43,7 +43,7 @@
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{currentPath}">
+ selectedChild="#{selectedRawUIBean.fileName}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<c:choose>
<c:when test="#{readOnly}">
@@ -57,7 +57,7 @@
</c:when>
<c:otherwise>
<rich:panelMenuItem label=""
- icon="#{rawConfigUIBean.icon}">
+ icon="/images/blank.png">
<h:panelGrid columns="2" columnClasses="rawConfigFileNameCol,rawConfigUndoCol">
<h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onmousedown"
commit 5c0ffac79be2109e07fba8f262b0c2913252341a
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 11 10:14:51 2010 -0500
Changing file path status lable to a regular JSF label and updating some of the file menu rerendering
The status label would change to say 'Loading <path name>..." when you select a file. The
problem though is that if File 1 is currently displayed and you click on File 2, the status
lable would read, 'Loading File 1...', and then when File 2 is rendered, the label would
read 'File 2'. In order to get the status message to display, 'Loading File 2...', there
needs to be some JavaScript to update the label to the selected file. I spent a little bit
of time investigating this but did not find a solution. I decided to change it to just a
regular label that is only change once the new file is rendered. This way the label always
displays the correct name.
Updating the file menu rendering logic. On edit.xhtml, the background of the selected file
was not changing. I previously was rerendering the entire file menu when a file menu item
is selected. By not rerendering the entire file menu, the background of the selected menu
item changes. Not sure why this behaves the way it does.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index dc5ca86..0e1d31d 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -32,7 +32,6 @@
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel id="fileMenuPanel" style="width:100%; background-color: rgb(217, 223, 227);">
<h:outputLabel value="Files" style="font-weight: bold; padding-left: 5px;"/>
- <ui:remove><f:facet name="header">Files</f:facet></ui:remove>
<rich:panelMenu id="fileMenu"
mode="ajax"
expandMode="client"
@@ -59,20 +58,20 @@
<c:otherwise>
<rich:panelMenuItem label=""
icon="#{rawConfigUIBean.icon}">
- <h:panelGrid columns="2" columnClasses="rawConfigFileNameCol, rawConfigUndoCol">
+ <h:panelGrid columns="2" columnClasses="rawConfigFileNameCol,rawConfigUndoCol">
<h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onmousedown"
onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
action="#{configurationEditor.select(rawConfigUIBean.path)}"
limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel,uploadWindow"/>
+ reRender="fileContents,selectedFileHeader,modalEditor,uploadWindow"/>
</h:outputLabel>
<a4j:commandButton value="Undo"
styleClass="rawConfigUndoButton"
rendered="#{rawConfigUIBean.modified}"
action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
+ reRender="fileMenu,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
</h:panelGrid>
</rich:panelMenuItem>
</c:otherwise>
@@ -115,11 +114,7 @@
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"
- startStyleClass="rawConfgFileHeader"
- stopStyleClass="rawConfigFileHeader"/>
+ <h:outputLabel id="selectedFileHeader" value="#{selectedRawUIBean.path}" styleClass="rawConfigFileHeader"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
commit f27118dddc566e4f7283820f8ddfd4fa05966166
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 16:04:39 2010 +0100
Fix links to the new alert definition pages.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
index 8d3cb0b..ad870c8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
@@ -113,7 +113,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}"
+ <h:outputLink value="#{onf:getDefaultResourceTabURL()}"
rendered="#{not empty item.parentResourceName}">
<f:param name="id" value="#{item.parentResourceId}" />
<h:outputText value="#{item.parentResourceName}" />
@@ -149,20 +149,17 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do" rendered="#{empty item.alertDefinition.resourceType and empty item.alertDefinition.resourceGroup}">
- <f:param name="mode" value="viewRoles" />
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{empty item.alertDefinition.resourceType and empty item.alertDefinition.resourceGroup}">
<f:param name="id" value="#{item.alertDefinition.resource.id}" />
<f:param name="ad" value="#{item.alertDefinition.id}" />
<h:outputText value="#{item.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.resourceType}">
- <f:param name="mode" value="viewRoles" />
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.alertDefinition.resourceType}">
<f:param name="type" value="#{item.alertDefinition.resourceType.id}" />
<f:param name="ad" value="#{item.alertDefinition.id}" />
<h:outputText value="#{item.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.resourceGroup}">
- <f:param name="mode" value="viewRoles" />
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml" rendered="#{not empty item.alertDefinition.resourceGroup}">
<f:param name="groupId" value="#{item.alertDefinition.resourceGroup.id}" />
<f:param name="ad" value="#{item.alertDefinition.id}" />
<h:outputText value="#{item.alertDefinition.name}" />
@@ -198,7 +195,7 @@
<f:param name="ad" value="#{item.alertDefinition.parentId}"/>
<h:outputText value="View Template" />
</h:outputLink>
-
+
<h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.groupAlertDefinition}">
<f:param name="mode" value="viewRoles"/>
<f:param name="groupId" value="#{item.alertDefinition.groupAlertDefinition.resourceGroup.id}"/>
@@ -206,8 +203,8 @@
<f:param name="ad" value="#{item.alertDefinition.groupAlertDefinition.id}"/>
<h:outputText value="View Group Definition" />
</h:outputLink>
-
- <h:outputText value="N/A"
+
+ <h:outputText value="N/A"
rendered="#{item.alertDefinition.parentId eq 0 and empty item.alertDefinition.groupAlertDefinition}" />
</rich:column>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
index a4b4ad3..2186950 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
@@ -144,8 +144,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do">
- <f:param name="mode" value="viewRoles" />
+ <h:outputLink value="/rhq/resource/alert/viewAlert.xhtml">
<f:param name="id" value="#{item.alert.alertDefinition.resource.id}" />
<f:param name="ad" value="#{item.alert.alertDefinition.id}" />
commit e10c2ad8e1f48e40cf71cf04806fee27e8e98ce2
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 15:54:46 2010 +0100
Add acknowledgement info to the subsystem view.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
index 5b62ecf..6c34c28 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
@@ -32,15 +32,19 @@ import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.composite.AlertHistoryComposite;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.util.MeasurementConverter;
+import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.gui.util.StringUtility;
import org.rhq.enterprise.gui.common.converter.SelectItemUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -144,6 +148,28 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
return "success";
}
+ public String acknowledgeSelectedAlerts() {
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ Resource resource = EnterpriseFacesContextUtility.getResource();
+ AlertManagerLocal alertManager = LookupUtil.getAlertManager();
+
+ try {
+ Integer[] selectedItems = getSelectedItems();
+ int num = alertManager.acknowledgeAlerts(subject,resource.getId(), selectedItems);
+ if (num==-1)
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,"No Alerts passed to ack");
+ else
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO,"Acknowledged " + num + " alerts");
+ } catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to acknowledge selected alerts.", e);
+ }
+
+ return "success";
+
+ }
+
+
@Override
public DataModel getDataModel() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
index 7922a38..b6e386c 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
@@ -172,9 +172,7 @@
<rich:column>
<f:facet name="header">
- <onc:sortableColumnHeader sort="a.ackBy.name">
<h:outputText styleClass="headerText" value="Ack by" />
- </onc:sortableColumnHeader>
</f:facet>
<h:outputText value="#{item.alert.ackBy.name}" title="#{item.alert.ackBy.firstName} #{item.alert.ackBy.lastName}"/>
</rich:column>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
index fc1c9c9..a4b4ad3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
@@ -74,7 +74,7 @@
value="#{alertHistoryDataModel}"
var="item"
width="100%"
- columnsWidth="1%, 15%, 15%, 15%, 15%, 15%, 15%, 10%"
+ columnsWidth="1%, 15%, 10%, 10%, 10%, 15%, 10%, 10%, 10% 10%"
headerClass="tableRowHeader"
footerClass="on-pager-footer"
onRowMouseOver="this.style.backgroundColor='#E7E7E7'"
@@ -172,6 +172,25 @@
</rich:column>
<rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Ack by" />
+ </f:facet>
+ <h:outputText value="#{item.alert.ackBy.name}" title="#{item.alert.ackBy.firstName} #{item.alert.ackBy.lastName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <onc:sortableColumnHeader sort="a.ackTime">
+ <h:outputText styleClass="headerText" value="Ack date" />
+ </onc:sortableColumnHeader>
+ </f:facet>
+ <h:outputText value="#{item.alert.ackTime}">
+ <f:converter converterId="RelativeDurationConverter" />
+ </h:outputText>
+ </rich:column>
+
+
+ <rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Recovery Info" />
</f:facet>
@@ -180,13 +199,17 @@
<f:facet name="footer">
<rich:columnGroup>
- <rich:column colspan="8" width="100%">
+ <rich:column colspan="10" width="100%">
<onc:selectCommandButton action="#{SubsystemAlertHistoryUIBean.deleteSelected}"
value="DELETE SELECTED" target="selectedItems" styleClass="on-pager-button buttonsmall"
rendered="#{GlobalPermissionsUIBean.superuser}" />
<h:commandButton action="#{SubsystemAlertHistoryUIBean.purge}"
value="PURGE ALL" styleClass="on-pager-button buttonsmall"
rendered="#{GlobalPermissionsUIBean.superuser}" />
+ <onc:selectCommandButton action="#{SubsystemAlertHistoryUIBean.acknowledgeSelectedAlerts}"
+ value="ACKNOWLEDGE SELECTED" target="selectedAlerts" styleClass="on-pager-button buttonsmall"
+ rendered="#{GlobalPermissionsUIBean.superuser}" />
+
<ui:param name="paginationDataTableName" value="alertHistoryDataTable"/>
<ui:param name="paginationDataModel" value="#{alertHistoryDataModel}"/>
commit 67fe27b4ceb14e01e1e553de8fc39ff1a1cc434f
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 15:34:28 2010 +0100
Be less verbose
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
index 618cbd7..7fb3fa6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
@@ -120,7 +120,7 @@ public class EmailManagerBean implements EmailManagerLocal {
InternetAddress recipient = new InternetAddress(toAddress);
Transport.send(mimeMessage, new InternetAddress[] { recipient });
} catch (Exception e) {
- LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]", e);
+ LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]: " + e.getMessage());
badAdresses.add(toAddress);
// Remember the first error - in case its due to a session initialization problem,
commit 3ea083ba2f47ae12b16ebfb3c09d08814006f451
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 15:34:12 2010 +0100
This index is no longer unique
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f91a292..5fd6d0c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.77.4</db.schema.version>
+ <db.schema.version>2.77.5</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index d8ce079..eb2fd2a 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -93,7 +93,7 @@
<column name="ID" default="sequence-only" initial="10001"
primarykey="true" required="true" type="INTEGER"/>
<column name="ALERT_ID" required="true" type="INTEGER" references="RHQ_ALERT(ID)"/>
- <index name="RHQ_ALERT_IDX_ALERT" unique="true">
+ <index name="RHQ_ALERT_IDX_ALERT" unique="false">
<field ref="ALERT_ID"/>
</index>
<column name="SENDER" required="false" size="200" type="VARCHAR2"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index febfa44..f7d4649 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3029,7 +3029,16 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="255" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="ALL_EMAILS" columnType="VARCHAR2" precision="4096" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_FAILED" columnType="VARCHAR2" precision="4096" />
-
+ </schemaSpec>
+ <schemaSpec version="2.77.5">
+ <schema-directSQL>
+ <statement>
+ DROP INDEX IF EXISTS RHQ_ALERT_IDX_ALERT
+ </statement>
+ <statement>
+ CREATE INDEX RHQ_ALERT_IDX_ALERT ON RHQ_ALERT_NOTIF_LOG (alert_id)
+ </statement>
+ </schema-directSQL>
</schemaSpec>
</dbupgrade>
</target>
commit 777fd10fbb237c964d7870b760a17a4e8520e7d6
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 11 15:19:16 2010 +0100
converted group member list and group member selection page to use resource name disambiguation.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ListResourceGroupMembersUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ListResourceGroupMembersUIBean.java
index 9bed106..747bd2a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ListResourceGroupMembersUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/group/ListResourceGroupMembersUIBean.java
@@ -31,9 +31,11 @@ import org.rhq.core.domain.resource.composite.ResourceFacets;
import org.rhq.core.domain.resource.composite.ResourceWithAvailability;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.server.alert.engine.internal.Tuple;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
@@ -45,6 +47,13 @@ public class ListResourceGroupMembersUIBean extends PagedDataTableUIBean {
private ResourceTypeManagerLocal resourceTypeManager = LookupUtil.getResourceTypeManager();
private boolean showRecursiveMembers = false;
+ private static final IntExtractor<ResourceWithAvailability> RESOURCE_ID_EXTRACTOR = new IntExtractor<ResourceWithAvailability>() {
+
+ public int extract(ResourceWithAvailability object) {
+ return object.getResource().getId();
+ }
+ };
+
public ListResourceGroupMembersUIBean() {
}
@@ -116,15 +125,14 @@ public class ListResourceGroupMembersUIBean extends PagedDataTableUIBean {
return results;
}
- protected class ListResourceGroupMembersDataModel extends PagedListDataModel<ResourceWithAvailability> {
+ protected class ListResourceGroupMembersDataModel extends ResourceNameDisambiguatingPagedListDataModel<ResourceWithAvailability> {
private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
public ListResourceGroupMembersDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
- @Override
- public PageList<ResourceWithAvailability> fetchPage(PageControl pageControl) {
+ public PageList<ResourceWithAvailability> fetchDataForPage(PageControl pageControl) {
PageList<ResourceWithAvailability> results = null;
if (getShowRecursiveMembers()) {
results = resourceManager.findImplicitResourceWithAvailabilityByResourceGroup(LookupUtil
@@ -141,5 +149,9 @@ public class ListResourceGroupMembersUIBean extends PagedDataTableUIBean {
return results;
}
+
+ protected IntExtractor<ResourceWithAvailability> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
index 85d164a..698cb5a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/group/inventory/AddGroupResourcesFormPrepareAction.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.legacy.action.resource.group.inventory;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -36,10 +37,16 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.DisambiguationReport;
+import org.rhq.core.domain.resource.composite.ResourceNamesDisambiguationResult;
+import org.rhq.core.domain.resource.composite.ResourceParentFlyweight;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.IntExtractor;
+import org.rhq.enterprise.gui.inventory.resource.ResourcePartialLineageComponent;
+import org.rhq.enterprise.gui.inventory.resource.ResourcePartialLineageRenderer;
import org.rhq.enterprise.gui.legacy.Constants;
import org.rhq.enterprise.gui.legacy.util.RequestUtils;
import org.rhq.enterprise.gui.legacy.util.SessionUtils;
@@ -54,6 +61,12 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class AddGroupResourcesFormPrepareAction extends Action {
private static final String CATEGORY_ALL = "None";
+ private static final IntExtractor<Resource> RESOURCE_ID_EXTRACTOR = new IntExtractor<Resource>() {
+ public int extract(Resource object) {
+ return object.getId();
+ }
+ };
+
/**
* Retrieve this data and store it in the specified request parameters:
*
@@ -108,6 +121,11 @@ public class AddGroupResourcesFormPrepareAction extends Action {
PageList<Resource> pendingResources = resourceManager.findResourceByIds(user, pendingResourceIds, true,
pcPending);
+ ResourceNamesDisambiguationResult<Resource> pendingResourcesDisambiguation =
+ resourceManager.disambiguate(pendingResources, true, RESOURCE_ID_EXTRACTOR);
+
+ pendingResources = buildResourceList(pendingResourcesDisambiguation, pendingResources.getTotalSize(), pendingResources.getPageControl());
+
request.setAttribute(Constants.PENDING_RESOURCES_ATTR, pendingResources);
request.setAttribute(Constants.NUM_PENDING_RESOURCES_ATTR, pendingResources.size());
@@ -134,6 +152,11 @@ public class AddGroupResourcesFormPrepareAction extends Action {
+ resourceGroup.getClass().getSimpleName() + " group type");
}
+ ResourceNamesDisambiguationResult<Resource> availableResourcesDisambiguation =
+ resourceManager.disambiguate(availableResources, true, RESOURCE_ID_EXTRACTOR);
+
+ availableResources = buildResourceList(availableResourcesDisambiguation, availableResources.getTotalSize(), availableResources.getPageControl());
+
request.setAttribute(Constants.AVAIL_RESOURCES_ATTR, availableResources);
request.setAttribute(Constants.NUM_AVAIL_RESOURCES_ATTR, availableResources.size());
@@ -164,4 +187,40 @@ public class AddGroupResourcesFormPrepareAction extends Action {
return resourceCategoryTypes;
}
+
+ //
+ // These two methods are to support the resource names disambiguation in the above code.
+ // Hopefully this page gets rewritten in JSF so that we don't have to employ this kind of
+ // nasties.
+ //
+
+ private static PageList<Resource> buildResourceList(ResourceNamesDisambiguationResult<Resource> results, int totalSize, PageControl pageControl) {
+ ArrayList<Resource> convertedResults = new ArrayList<Resource>(results.getResolution().size());
+
+ for(DisambiguationReport<Resource> dr : results.getResolution()) {
+ Resource resource = dr.getOriginal();
+
+ Resource parent = resource.getParentResource();
+ parent.setName(buildLineage(dr.getParents()));
+
+ convertedResults.add(resource);
+ }
+ return new PageList<Resource>(convertedResults, totalSize, pageControl);
+ }
+
+ private static String buildLineage(List<ResourceParentFlyweight> parents) {
+ if (parents == null || parents.size() == 0) {
+ return "";
+ }
+
+ Iterator<ResourceParentFlyweight> it = parents.iterator();
+
+ StringBuilder bld = new StringBuilder(it.next().getParentName());
+
+ while (it.hasNext()) {
+ bld.append(ResourcePartialLineageComponent.DEFAULT_SEPARATOR).append(it.next().getParentName());
+ }
+
+ return bld.toString();
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/group/inventory/AddResourcesForm.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/group/inventory/AddResourcesForm.jsp
index 22996c1..0c0dbfe 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/group/inventory/AddResourcesForm.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/group/inventory/AddResourcesForm.jsp
@@ -407,8 +407,7 @@ widgetProperties = getWidgetProperties('<c:out value="${widgetInstanceName}"/>')
width="30%"
sortAttr="res.name" />
<display:column property="parentResource.name" title="resource.group.inventory.ParentTH"
- width="30%"
- sortAttr="parent.name" />
+ width="30%" />
<display:column property="resourceType.name" title="resource.group.inventory.TypeTH"
width="39%"
sortAttr="res.resourceType.name" >
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view.xhtml
index 91d8b11..a7076f4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/inventory/view.xhtml
@@ -174,8 +174,8 @@
<onc:allSelect target="selectedResources" />
</f:facet>
- <onc:select name="selectedResources" value="#{resourceWithAvailability.resource.id}"
- rendered="#{resourceWithAvailability.explicit}"/>
+ <onc:select name="selectedResources" value="#{resourceWithAvailability.original.resource.id}"
+ rendered="#{resourceWithAvailability.original.explicit}"/>
</rich:column>
<rich:column>
@@ -184,7 +184,7 @@
</f:facet>
<onc:quickNav>
- <f:param name="id" value="#{resourceWithAvailability.resource.id}"/>
+ <f:param name="id" value="#{resourceWithAvailability.original.resource.id}"/>
<onc:icon name="Monitor"
url="/rhq/resource/monitor/graphs.xhtml"
@@ -204,17 +204,17 @@
<onc:icon name="Configure"
url="/rhq/resource/configuration/view.xhtml"
alt="Configure"
- visible="#{resourceWithAvailability.resourceFacets.configuration}"/>
+ visible="#{resourceWithAvailability.original.resourceFacets.configuration}"/>
<onc:icon name="Operation"
url="/rhq/resource/operation/resourceOperationScheduleNew.xhtml"
alt="Operations"
- visible="#{resourceWithAvailability.resourceFacets.operation}"/>
+ visible="#{resourceWithAvailability.original.resourceFacets.operation}"/>
<onc:icon name="Content"
url="/rhq/resource/content/view.xhtml"
alt="Content"
- visible="#{resourceWithAvailability.resourceFacets.content}"/>
+ visible="#{resourceWithAvailability.original.resourceFacets.content}"/>
<!-- Is this necessary? It's being passed for all quick nav urls. -->
<f:param name="mode" value="list"/>
@@ -230,22 +230,17 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceWithAvailability.resource.id}"/>
- <h:outputText value="#{resourceWithAvailability.resource.name}"/>
+ <f:param name="id" value="#{resourceWithAvailability.original.resource.id}"/>
+ <h:outputText value="#{resourceWithAvailability.original.resource.name}"/>
</h:outputLink>
</rich:column>
<rich:column >
<f:facet name="header">
- <onc:sortableColumnHeader sort="parent.name">
- <h:outputText styleClass="headerText" value="Parent"/>
- </onc:sortableColumnHeader>
+ <h:outputText styleClass="headerText" value="Parent"/>
</f:facet>
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceWithAvailability.parent.id}"/>
- <h:outputText value="#{resourceWithAvailability.parent.name}"/>
- </h:outputLink>
+ <onc:resourcePartialLineage parents="#{resourceWithAvailability.parents}" />
</rich:column>
<rich:column>
@@ -255,7 +250,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{resourceWithAvailability.resource.resourceType.category}"/>
+ <h:outputText value="#{resourceWithAvailability.original.resource.resourceType.category}"/>
</rich:column>
<rich:column>
@@ -265,7 +260,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{resourceWithAvailability.resource.resourceType.name}"/>
+ <h:outputText value="#{resourceWithAvailability.resourceTypeName}"/>
</rich:column>
<rich:column>
@@ -273,7 +268,7 @@
<h:outputText styleClass="headerText" value="Description"/>
</f:facet>
- <h:outputText value="#{resourceWithAvailability.resource.description}"/>
+ <h:outputText value="#{resourceWithAvailability.original.resource.description}"/>
</rich:column>
<rich:column>
@@ -284,11 +279,11 @@
</f:facet>
<h:graphicImage value="/images/icons/availability_green_16.png" alt="Up" title="Up"
- rendered="#{resourceWithAvailability.availability == 'UP'}"/>
+ rendered="#{resourceWithAvailability.original.availability == 'UP'}"/>
<h:graphicImage value="/images/icons/availability_red_16.png" alt="Down" title="Down"
- rendered="#{resourceWithAvailability.availability == 'DOWN'}"/>
+ rendered="#{resourceWithAvailability.original.availability == 'DOWN'}"/>
<h:graphicImage value="/images/icons/availability_grey_16.png" alt="Unknown" title="Unknown"
- rendered="#{resourceWithAvailability.availability == null}"/>
+ rendered="#{resourceWithAvailability.original.availability == null}"/>
</rich:column>
<f:facet name="footer">
commit ce98999380b4f945795c5635a51056c9e20cfc64
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 10 17:21:07 2010 +0100
the /rhq/content/repo.xhtml and repoSubscriptions.xhtml converted to use resource names disambiguation.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoResourcesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoResourcesUIBean.java
index 7edfa3e..5521445 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoResourcesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoResourcesUIBean.java
@@ -25,9 +25,11 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -35,6 +37,12 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class RepoResourcesUIBean extends PagedDataTableUIBean {
public static final String MANAGED_BEAN_NAME = "RepoResourcesUIBean";
+ private static final IntExtractor<Resource> RESOURCE_ID_EXTRACTOR = new IntExtractor<Resource>() {
+ public int extract(Resource r) {
+ return r.getId();
+ }
+ };
+
public RepoResourcesUIBean() {
}
@@ -75,14 +83,12 @@ public class RepoResourcesUIBean extends PagedDataTableUIBean {
return dataModel;
}
- private class RepoResourcesDataModel extends PagedListDataModel<Resource> {
+ private class RepoResourcesDataModel extends ResourceNameDisambiguatingPagedListDataModel<Resource> {
public RepoResourcesDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
- @Override
- @SuppressWarnings("unchecked")
- public PageList<Resource> fetchPage(PageControl pc) {
+ public PageList<Resource> fetchDataForPage(PageControl pc) {
Subject subject = EnterpriseFacesContextUtility.getSubject();
int id = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("id"));
RepoManagerLocal manager = LookupUtil.getRepoManagerLocal();
@@ -90,6 +96,10 @@ public class RepoResourcesUIBean extends PagedDataTableUIBean {
PageList<Resource> results = manager.findSubscribedResources(subject, id, pc);
return results;
}
+
+ protected IntExtractor<Resource> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
}
private String[] getSelectedRepoResources() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoSubscriptionsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoSubscriptionsUIBean.java
index f86d2c2..025d5f9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoSubscriptionsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoSubscriptionsUIBean.java
@@ -26,9 +26,10 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
-import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -42,6 +43,12 @@ public class RepoSubscriptionsUIBean extends PagedDataTableUIBean {
public RepoSubscriptionsUIBean() {
}
+ private static final IntExtractor<Resource> RESOURCE_ID_EXTRACTOR = new IntExtractor<Resource>() {
+ public int extract(Resource r) {
+ return r.getId();
+ }
+ };
+
public String deleteSelectedRepoSubscriptions() {
Subject subject = EnterpriseFacesContextUtility.getSubject();
String[] selected = getSelectedRepoSubscriptions();
@@ -77,14 +84,12 @@ public class RepoSubscriptionsUIBean extends PagedDataTableUIBean {
return dataModel;
}
- private class RepoSubscriptionsDataModel extends PagedListDataModel<Resource> {
+ private class RepoSubscriptionsDataModel extends ResourceNameDisambiguatingPagedListDataModel<Resource> {
public RepoSubscriptionsDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
- @Override
- @SuppressWarnings("unchecked")
- public PageList<Resource> fetchPage(PageControl pc) {
+ public PageList<Resource> fetchDataForPage(PageControl pc) {
Subject subject = EnterpriseFacesContextUtility.getSubject();
int id = Integer.valueOf(FacesContextUtility.getRequiredRequestParameter("id"));
RepoManagerLocal manager = LookupUtil.getRepoManagerLocal();
@@ -92,6 +97,10 @@ public class RepoSubscriptionsUIBean extends PagedDataTableUIBean {
PageList<Resource> results = manager.findSubscribedResources(subject, id, pc);
return results;
}
+
+ protected IntExtractor<Resource> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
}
private String[] getSelectedRepoSubscriptions() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoUnsubscriptionsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoUnsubscriptionsUIBean.java
index 304f3dd..59b5a0a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoUnsubscriptionsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/RepoUnsubscriptionsUIBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.gui.content;
+
import javax.faces.application.FacesMessage;
import javax.faces.model.DataModel;
@@ -27,9 +28,10 @@ import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.framework.PagedDataTableUIBean;
import org.rhq.enterprise.gui.common.paging.PageControlView;
-import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.content.RepoManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@@ -41,6 +43,12 @@ public class RepoUnsubscriptionsUIBean extends PagedDataTableUIBean {
private String searchString = null;
private String searchCategory = null;
+ private static final IntExtractor<Resource> RESOURCE_ID_EXTRACTOR = new IntExtractor<Resource>() {
+ public int extract(Resource r) {
+ return r.getId();
+ }
+ };
+
public RepoUnsubscriptionsUIBean() {
}
@@ -99,13 +107,12 @@ public class RepoUnsubscriptionsUIBean extends PagedDataTableUIBean {
return dataModel;
}
- private class RepoUnsubscriptionsDataModel extends PagedListDataModel<Resource> {
+ private class RepoUnsubscriptionsDataModel extends ResourceNameDisambiguatingPagedListDataModel<Resource> {
public RepoUnsubscriptionsDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
- @Override
- public PageList<Resource> fetchPage(PageControl pc) {
+ public PageList<Resource> fetchDataForPage(PageControl pc) {
Subject subject = EnterpriseFacesContextUtility.getSubject();
ResourceManagerLocal manager = LookupUtil.getResourceManager();
int repoId = Integer.parseInt(FacesContextUtility.getRequiredRequestParameter("id"));
@@ -130,6 +137,10 @@ public class RepoUnsubscriptionsUIBean extends PagedDataTableUIBean {
return results;
}
+
+ protected IntExtractor<Resource> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
}
private String[] getSelectedRepoUnsubscriptions() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repo.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repo.xhtml
index 8837813..1a12dd0 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repo.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repo.xhtml
@@ -392,10 +392,10 @@
<f:facet name="header">
<onc:allSelect target="selectedRepoResources" />
</f:facet>
-
+
<onc:select name="selectedRepoResources"
- value="#{resourceitem.id}" />
- </rich:column>
+ value="#{resourceitem.original.id}" />
+ </rich:column>
<rich:column rendered="#{param.debug}">
<f:facet name="header">
@@ -403,8 +403,8 @@
<h:outputText styleClass="headerText" value="ID" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputText value="#{resourceitem.id}" />
+
+ <h:outputText value="#{resourceitem.original.id}" />
</rich:column>
<rich:column>
@@ -415,12 +415,19 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceitem.id}" />
- <h:outputText value="#{resourceitem.name}" />
+ <f:param name="id" value="#{resourceitem.original.id}" />
+ <h:outputText value="#{resourceitem.original.name}" />
</h:outputLink>
</rich:column>
<rich:column>
+ <f:facet name="header">
+ <h:outputText value="Parent" />
+ </f:facet>
+ <onc:resourcePartialLineage parents="#{resourceitem.parents}"/>
+ </rich:column>
+
+ <rich:column>
<f:facet name="header">
<onc:sortableColumnHeader
sort="rc.resource.resourceType.name">
@@ -428,8 +435,8 @@
value="Resource Type" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputText value="#{resourceitem.resourceType.name}" />
+
+ <h:outputText value="#{resourceitem.resourceTypeName}" />
</rich:column>
<rich:column>
@@ -438,8 +445,8 @@
<h:outputText styleClass="headerText" value="Version" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputText value="#{resourceitem.version}" />
+
+ <h:outputText value="#{resourceitem.original.version}" />
</rich:column>
<rich:column>
@@ -449,14 +456,14 @@
value="Description" />
</onc:sortableColumnHeader>
</f:facet>
-
- <h:outputText value="#{resourceitem.description}" />
+
+ <h:outputText value="#{resourceitem.original.description}" />
</rich:column>
<f:facet name="footer">
<rich:columnGroup>
<!-- colspan 6:5 for the debug 'id' column -->
- <rich:column colspan="#{param.debug ? 6 : 5}"
+ <rich:column colspan="#{param.debug ? 7 : 6}"
width="100%">
<h:commandButton
action="#{RepoResourcesUIBean.subscribeResources}"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repoSubscriptions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repoSubscriptions.xhtml
index ec460b9..2977cda 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repoSubscriptions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/content/repoSubscriptions.xhtml
@@ -83,7 +83,7 @@
<onc:allSelect target="selectedRepoSubscriptions" />
</f:facet>
- <onc:select name="selectedRepoSubscriptions" value="#{resourceitem.id}" />
+ <onc:select name="selectedRepoSubscriptions" value="#{resourceitem.original.id}" />
</rich:column>
<rich:column rendered="#{param.debug}">
@@ -93,7 +93,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{resourceitem.id}"/>
+ <h:outputText value="#{resourceitem.original.id}"/>
</rich:column>
<rich:column>
@@ -104,19 +104,26 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{resourceitem.id}"/>
- <h:outputText value="#{resourceitem.name}" />
+ <f:param name="id" value="#{resourceitem.original.id}"/>
+ <h:outputText value="#{resourceitem.original.name}" />
</h:outputLink>
</rich:column>
<rich:column>
<f:facet name="header">
+ <h:outputText value="Parent" />
+ </f:facet>
+ <onc:resourcePartialLineage parents="#{resourceitem.parents}" />
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
<onc:sortableColumnHeader sort="rc.resource.resourceType.name">
<h:outputText styleClass="headerText" value="Resource Type" />
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{resourceitem.resourceType.name}"/>
+ <h:outputText value="#{resourceitem.resourceTypeName}"/>
</rich:column>
<rich:column>
@@ -124,7 +131,7 @@
<h:outputText styleClass="headerText" value="Version" />
</f:facet>
- <h:outputText value="#{resourceitem.version}"/>
+ <h:outputText value="#{resourceitem.original.version}"/>
</rich:column>
<rich:column>
@@ -132,7 +139,7 @@
<h:outputText styleClass="headerText" value="Description" />
</f:facet>
- <h:outputText value="#{resourceitem.description}"/>
+ <h:outputText value="#{resourceitem.original.description}"/>
</rich:column>
<f:facet name="footer">
@@ -219,7 +226,7 @@
<onc:allSelect target="selectedRepoUnsubscriptions" />
</f:facet>
- <onc:select name="selectedRepoUnsubscriptions" value="#{availableitem.id}" />
+ <onc:select name="selectedRepoUnsubscriptions" value="#{availableitem.original.id}" />
</rich:column>
<rich:column rendered="#{param.debug}">
@@ -229,7 +236,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{availableitem.id}"/>
+ <h:outputText value="#{availableitem.original.id}"/>
</rich:column>
<rich:column>
@@ -240,19 +247,27 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{availableitem.id}"/>
- <h:outputText value="#{availableitem.name}" />
+ <f:param name="id" value="#{availableitem.original.id}"/>
+ <h:outputText value="#{availableitem.original.name}" />
</h:outputLink>
</rich:column>
<rich:column>
<f:facet name="header">
+ <h:outputText value="Parent"/>
+ </f:facet>
+
+ <onc:resourcePartialLineage parents="#{availableitem.parents}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
<onc:sortableColumnHeader sort="res.resourceType.name">
<h:outputText styleClass="headerText" value="Resource Type" />
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{availableitem.resourceType.name}"/>
+ <h:outputText value="#{availableitem.resourceTypeName}"/>
</rich:column>
<rich:column>
@@ -262,7 +277,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{availableitem.version}"/>
+ <h:outputText value="#{availableitem.original.version}"/>
</rich:column>
<rich:column>
@@ -270,7 +285,7 @@
<h:outputText styleClass="headerText" value="Description" />
</f:facet>
- <h:outputText value="#{availableitem.description}"/>
+ <h:outputText value="#{availableitem.original.description}"/>
</rich:column>
<f:facet name="footer">
commit f156f87cc98b090820345b1cd043437f9c9890e9
Merge: 8a44148... 98b5b4d...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:44:50 2010 +0100
Merge branch 'master' into alertPlugin
commit 8a44148c7f2305ea82d2395b6853d3bb36166869
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:43:45 2010 +0100
First cut at an operations alert sender.
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml
new file mode 100644
index 0000000..98f835e
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/pom.xml
@@ -0,0 +1,180 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <groupId>org.rhq</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-operations</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+
+ <name>RHQ Enterprise Server Opertions Alert Plugin</name>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/enterprise/server/plugins/alert-operations/</scm.module.path>
+ <seam.version>2.1.0.SP1</seam.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+<!--
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-resteasy-jars</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+-->
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
new file mode 100644
index 0000000..32e9f16
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsBackingBean.java
@@ -0,0 +1,168 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.enterprise.server.operation.OperationManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Backing bean for the operations alert sender
+ * @author Heiko W. Rupp
+ */
+
+public class OperationsBackingBean extends CustomAlertSenderBackingBean {
+
+ private final Log log = LogFactory.getLog(OperationsBackingBean.class);
+
+ private String resMode;
+ Integer resId;
+ private String operationName;
+ private Map<String,String> operationNames = new HashMap<String,String>();
+ private ConfigurationDefinition configurationDefinition;
+ private Configuration configuration;
+ private static final String ALERT_NOTIFICATIONS = "ALERT_NOTIFICATIONS";
+
+ public String selectResource() {
+
+ log.info("In select Resource, resId is " + resId + " resMode is " + resMode);
+
+ if (resId != null)
+ persistProperty(alertParameters, OperationsSender.RESOURCE_ID,resId);
+
+ obtainOperationNames();
+
+ return ALERT_NOTIFICATIONS;
+ }
+
+
+
+ public String selectOperation() {
+ log.info("In selectOperation, resId is " + resId + " opName is " + operationName);
+
+ if (operationName != null )
+ persistProperty(alertParameters, OperationsSender.OPERATION_NAME,operationName);
+
+ return ALERT_NOTIFICATIONS;
+ }
+
+ public String useConfiguration() {
+ log.info("In useConfiguration");
+
+ persistProperty(alertParameters, OperationsSender.USABLE,true);
+
+ return ALERT_NOTIFICATIONS;
+ }
+
+ private void obtainOperationNames() {
+
+ PropertySimple prop = alertParameters.getSimple(OperationsSender.RESOURCE_ID);
+ if (prop!=null)
+ resId = prop.getIntegerValue();
+
+ if (resId!=null) {
+ OperationManagerLocal opMan = LookupUtil.getOperationManager();
+
+ Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO replace with real subject
+ List<OperationDefinition> opDefs = opMan.findSupportedResourceOperations(subject, resId, false);
+ for (OperationDefinition def : opDefs) {
+ operationNames.put(def.getDisplayName(),def.getName()); // TODO add more distinctive stuff in display
+ }
+ }
+ }
+
+
+
+ public String getResMode() {
+ return resMode;
+ }
+
+ public void setResMode(String resMode) {
+ this.resMode = resMode;
+ }
+
+ public Integer getResId() {
+
+ if (resId==null) {
+ PropertySimple prop = alertParameters.getSimple(OperationsSender.RESOURCE_ID);
+ if (prop!=null)
+ resId = prop.getIntegerValue();
+ }
+
+ return resId;
+ }
+
+ public void setResId(Integer resId) {
+ this.resId = resId;
+ }
+
+ public String getOperationName() {
+
+ if (operationName==null) {
+ PropertySimple prop = alertParameters.getSimple(OperationsSender.OPERATION_NAME);
+ if (prop!=null)
+ operationName = prop.getStringValue();
+ }
+
+ return operationName;
+ }
+
+ public void setOperationName(String operationName) {
+ this.operationName = operationName;
+ }
+
+ public Map<String,String> getOperationNames() {
+
+ obtainOperationNames();
+
+ return operationNames;
+ }
+
+ public void setOperationNames(Map<String,String> operationNames) {
+ this.operationNames = operationNames;
+ }
+
+ public ConfigurationDefinition getConfigurationDefinition() {
+ return configurationDefinition;
+ }
+
+ public void setConfigurationDefinition(ConfigurationDefinition configurationDefinition) {
+ this.configurationDefinition = configurationDefinition;
+ }
+
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
new file mode 100644
index 0000000..4fa9bba
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/java/org/rhq/enterprise/server/plugins/alertOperations/OperationsSender.java
@@ -0,0 +1,77 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugins.alertOperations;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.enterprise.server.exception.ScheduleException;
+import org.rhq.enterprise.server.operation.OperationManagerLocal;
+import org.rhq.enterprise.server.operation.ResourceOperationSchedule;
+import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Alert sender that triggers an operation on the resource
+ * @author Heiko W. Rupp
+ */
+public class OperationsSender extends AlertSender {
+
+ private final Log log = LogFactory.getLog(OperationsSender.class);
+ static final String RESOURCE_ID = "resourceId";
+ static final String OPERATION_NAME = "operationName";
+ static final String USABLE = "usable";
+
+ @Override
+ public SenderResult send(Alert alert) {
+
+ PropertySimple resProp = alertParameters.getSimple(RESOURCE_ID);
+ PropertySimple opNameProp = alertParameters.getSimple(OPERATION_NAME);
+ if (resProp==null || resProp.getIntegerValue() == null || opNameProp == null || opNameProp.getStringValue() == null)
+ return new SenderResult(ResultState.FAILURE, "Not enough parameters given");
+
+ PropertySimple usableProp = alertParameters.getSimple(USABLE);
+ if (usableProp==null || usableProp.getBooleanValue()== null || usableProp.getBooleanValue() == false)
+ return new SenderResult(ResultState.FAILURE,"Not yet configured");
+
+ Integer resourceId = resProp.getIntegerValue();
+ String opName = opNameProp.getStringValue();
+
+ OperationManagerLocal opMgr = LookupUtil.getOperationManager();
+ Subject subject = LookupUtil.getSubjectManager().getOverlord(); // TODO get real subject
+
+ ResourceOperationSchedule sched;
+ try {
+ sched = opMgr.scheduleResourceOperation(subject, resourceId, opName, 0, 0, 0, 0, null,
+ "Alert operation for " + alert.getAlertDefinition().getName());
+ } catch (ScheduleException e) {
+ return new SenderResult(ResultState.FAILURE, "Scheduling of operation " + opName + " on resource " + resourceId + " failed: " + e.getMessage());
+ }
+
+ // TODO evaluate retuen of schedule() call and defer, so we can leter check
+ // If op sending was successfull
+ return new SenderResult(ResultState.SUCCESS, "Scheduled operation " + opName + " on resource " + resourceId + " with jobId " + sched.getJobId() );
+
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..9a02d3e
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<alert-plugin
+ name="alert-operations"
+ displayName="Alert:Operations"
+ xmlns="urn:xmlns:rhq-serverplugin.alert"
+ xmlns:c="urn:xmlns:rhq-configuration"
+ xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
+ package="org.rhq.enterprise.server.plugins.alertOperations"
+ description="Alert sender plugin that can run operations on resources in RHQ inventory."
+ >
+
+ <serverplugin:help>
+ This alert sender plugin is used to run operations on resources in RHQ inventory.
+ Operations need to exist on a resource before the plugin can use them.
+ </serverplugin:help>
+
+ <!-- startup & tear down listener, + scheduled jobs
+ <serverplugin:plugin-component class="Foo" />
+ -->
+
+ <!-- How does this sender show up in drop downs etc -->
+ <short-name>Operations</short-name>
+
+ <!-- Class that does the actual sending -->
+ <plugin-class>OperationsSender</plugin-class>
+
+ <custom-ui>
+ <ui-snippet-name>operations.xhtml</ui-snippet-name>
+ <backing-bean-class>OperationsBackingBean</backing-bean-class>
+ <backing-bean-name>operationsBean</backing-bean-name>
+ </custom-ui>
+</alert-plugin>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
new file mode 100644
index 0000000..1fd74ad
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-operations/src/main/resources/operations.xhtml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:a4j="https://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:onc="http://jboss.org/on/component"
+ >
+<head>
+ <title>Operations sender</title>
+</head>
+<body>
+<h:panelGrid columns="2" style="vertical-align:top" >
+ <h:panelGroup style="width:40%" >
+ <rich:panel>
+ <h:outputText value="Select mode"/>
+ <br/>
+ <h:selectOneMenu id="resMode" value="#{operationsBean.resMode}">
+ <f:selectItem itemValue="fixed" itemLabel="Resource ID"/>
+ <f:selectItem itemValue="deferred" itemLabel="Path to resource"/>
+ </h:selectOneMenu>
+ <p/>
+ <h:outputText value="Target resource"/>
+ <br/>
+ <h:inputText id="resourceId" title="Target Resource" value="#{operationsBean.resId}"/>
+ <p/>
+ <h:commandButton id="resourceIdSubmit"
+ value="Select"
+ type="submit"
+ action="#{operationsBean.selectResource}" />
+ </rich:panel>
+ </h:panelGroup>
+
+ <h:panelGroup style="width:60%">
+ <rich:panel rendered="#{not empty operationsBean.operationNames}">
+ <h:selectOneMenu id="selectOperationMenu" value="#{operationsBean.operationName}">
+ <f:selectItems value="#{operationsBean.operationNames}"/>
+ </h:selectOneMenu>
+ <p/>
+ <h:commandButton id="opNameSubmit"
+ value="Select"
+ type="submit"
+ action="#{operationsBean.selectOperation}" />
+ </rich:panel>
+ </h:panelGroup>
+</h:panelGrid>
+<p/>
+ <h:panelGroup style="width:100%">
+ <h:outputText value="3rd panel : "/>
+ <h:outputText value="#{operationsBean.operationName}"/>
+ <br/>
+ <rich:panel rendered="#{not empty operationsBean.operationName}">
+ <onc:config configurationDefinition="#{operationsBean.configurationDefinition}"
+ configuration="#{operationsBean.configuration}"
+ nullConfigurationDefinitionMessage="NUll configuration definition"
+ nullConfigurationMessage="null configuration"
+ nullConfigurationStyle="InfoBlock"
+
+ id="opParamConfiguration"
+ />
+ <p/>
+ <h:commandButton id="opParamSubmit"
+ value="Set"
+ type="submit"
+ action="#{operationsBean.useConfiguration}" />
+ </rich:panel>
+ </h:panelGroup>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 3d40978..eb03f07 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -71,6 +71,7 @@
<module>alert-irc</module>
<module>alert-mobicents</module>
<module>alert-microblog</module>
+ <module>alert-operations</module>
<module>alert-roles</module>
<module>alert-scriptlang</module>
<!-- Seeing strange issues with corrupt jar dependencies...
commit fbabb3fe07b0396684748a550266b0cd14950368
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:42:58 2010 +0100
Provide a helper to persist individual configuration properties.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index af5928c..db86e3d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.plugin.pc.alert;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -48,4 +49,19 @@ public class CustomAlertSenderBackingBean {
return config;
}
+
+ protected Configuration persistProperty(Configuration config, String propertyName, Object value) {
+
+ PropertySimple prop = config.getSimple(propertyName);
+ if (prop == null) {
+ prop = new PropertySimple(propertyName,value);
+ config.put(prop);
+ }
+ else {
+ prop.setValue(value);
+ }
+ Configuration ret = persistConfiguration(config);
+
+ return ret;
+ }
}
commit b78dd4d203175b122bf0f807142907e8de3b226d
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:39:10 2010 +0100
Change the way email addresses are set.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 409f6f2..ba75940 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -46,6 +46,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.util.StringUtils;
@Entity
@NamedQueries( {
@@ -105,7 +106,7 @@ public class AlertNotificationLog implements Serializable {
private String badEmails;
@Transient
- transient List<String> tranisentEmails = new ArrayList<String>();
+ transient List<String> transientEmails = new ArrayList<String>();
protected AlertNotificationLog() {
} // JPA
@@ -115,6 +116,10 @@ public class AlertNotificationLog implements Serializable {
this.sender = sender;
this.resultState = senderResult.getState();
this.message = senderResult.getMessage();
+ if (resultState == ResultState.DEFERRED_EMAIL && senderResult.getEmails() != null) {
+ this.transientEmails.addAll(senderResult.getEmails());
+ this.allEmails = StringUtils.getListAsString(senderResult.getEmails(),",");
+ }
}
public AlertNotificationLog(Alert alert, String sender) {
@@ -180,11 +185,26 @@ public class AlertNotificationLog implements Serializable {
this.badEmails = badEmails;
}
- public List<String> getTranisentEmails() {
- return tranisentEmails;
+ public List<String> getTransientEmails() {
+ return transientEmails;
}
- public void setTranisentEmails(List<String> tranisentEmails) {
- this.tranisentEmails = tranisentEmails;
+ public void setTransientEmails(List<String> transientEmails) {
+ this.transientEmails = transientEmails;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("AlertNotificationLog");
+ sb.append("{id=").append(id);
+ sb.append(", alert=").append(alert);
+ sb.append(", sender='").append(sender).append('\'');
+ sb.append(", resultState=").append(resultState);
+ sb.append(", message='").append(message).append('\'');
+ sb.append(", allEmails='").append(allEmails).append('\'');
+ sb.append(", badEmails='").append(badEmails).append('\'');
+ sb.append('}');
+ return sb.toString();
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index c321422..454b9a9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -696,8 +696,6 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
alNoLo = new AlertNotificationLog(alert, senderName, result);
if (result.getEmails() != null && !result.getEmails().isEmpty()) {
emailAddresses.addAll(result.getEmails());
- alNoLo.setTranisentEmails(result.getEmails());
- alNoLo.setAllEmails(StringUtils.getListAsString(result.getEmails(),","));
}
} else {
alNoLo = new AlertNotificationLog(alert, senderName, result);
@@ -734,7 +732,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
List<String> badList = new ArrayList<String>();
for (String badOne : badAddresses) {
- if (anl.getTranisentEmails().contains(badOne)) {
+ if (anl.getTransientEmails().contains(badOne)) {
anl.setResultState(ResultState.FAILED_EMAIL);
badList.add(badOne);
}
commit 2e7b36c55a7dcc62c1479234e5435db33d2853d7
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:35:20 2010 +0100
Provide link to resource overview page in breadcrumbs
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 1172f3e..8a1f9d2 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -47,7 +47,12 @@
<h:outputText> > </h:outputText>
<h:outputLink value="viewAlert.xhtml">
<f:param name="ad" value="#{param.ad}" />
- <h:outputText value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'" />
+ <h:outputText value=" Definition for '#{alertDefinition.name}' "/>
+ </h:outputLink>
+ <h:outputText> on resource </h:outputText>
+ <h:outputLink value="/rhq/resource/summary/overview.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}" />
+ <h:outputText value=" '#{alertDefinition.resource.name}'" />
</h:outputLink>
</ui:define>
@@ -198,7 +203,7 @@
styleClass="buttonmed"
style="margin-top: auto;">
</h:commandButton>
-
+
<h:outputLink id="alertTemplateCancelLink" styleClass="buttonmed" value="#" style="float: right; margin: 10px;">
<h:outputText value="Cancel" />
<rich:componentControl for="addAlertFromTemplatePanel" attachTo="alertTemplateCancelLink" operation="hide" event="onclick" />
@@ -237,7 +242,7 @@
<h:commandButton id="saveButton" value="Save Changes" styleClass="buttonmed" action="#{alertUIBean.saveAlertDefinition}" />
</h:form>
-
+
</rich:modalPanel>
</ui:define>
commit 2c092b02b062aeab9536e4b3eab2829779393c2c
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 11 14:27:19 2010 +0100
Increase footer width and make acknowledge columns sortable
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
index 946f196..7922a38 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
@@ -172,14 +172,18 @@
<rich:column>
<f:facet name="header">
- <h:outputText styleClass="headerText" value="Ack by" />
+ <onc:sortableColumnHeader sort="a.ackBy.name">
+ <h:outputText styleClass="headerText" value="Ack by" />
+ </onc:sortableColumnHeader>
</f:facet>
<h:outputText value="#{item.alert.ackBy.name}" title="#{item.alert.ackBy.firstName} #{item.alert.ackBy.lastName}"/>
</rich:column>
<rich:column>
<f:facet name="header">
- <h:outputText styleClass="headerText" value="Ack date" />
+ <onc:sortableColumnHeader sort="a.ackTime">
+ <h:outputText styleClass="headerText" value="Ack date" />
+ </onc:sortableColumnHeader>
</f:facet>
<h:outputText value="#{item.alert.ackTime}">
<f:converter converterId="RelativeDurationConverter" />
@@ -195,7 +199,7 @@
<f:facet name="footer">
<rich:columnGroup>
- <rich:column colspan="8" width="100%">
+ <rich:column colspan="9" width="100%">
<onc:selectCommandButton action="#{ListAlertHistoryUIBean.deleteSelectedAlerts}"
value="DELETE SELECTED" target="selectedAlerts" styleClass="on-pager-button buttonsmall"
rendered="#{ResourceUIBean.permissions.alert}" />
commit 95dc58b826020e2e7c850374a997a2ce9f019ee5
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 10 22:03:05 2010 -0500
Fixing file upload
There were a handful of changes needed to get things working. First, the upload component
needed to be in a form of its own. Secondly, the form has to be nested inside the modal
panel; otherwise, the upload listener is not called. I am not sure why that happens, but
this was reported in https://jira.jboss.org/jira/browse/RF-3492. Next, the resource id
cannot be submitted with the file upload request which causes problems in some places
that expect to find the resource id as a request parameter during the update model phase
of the JSF lifecycle. Two things were done to deal with this. First, the life of the
ResourceUIBean for a given request is extended using <a4j:keepAlive>. That allows us
to get ahold of the resource id from ResourceUIBean. Secondly, some code, like in
FavoritesUIBean, that was looking directly at the request for the id, was refactored to get
the id from ResourceUIBean.
The file upload code was pulled out of ResourceConfigurationEditor and put into a new seam
component, FileUploadComponent which is just a thin wrapper around FileUploadUIBean. Right
now FileUploadComponent is tightly coupled to raw config, but it can/should be refactored
so that it can be used for any file upload that implemented via richfaces and seam.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/FileUploadComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/FileUploadComponent.java
new file mode 100644
index 0000000..c0ae9f9
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/FileUploadComponent.java
@@ -0,0 +1,103 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.configuration.resource;
+
+import org.apache.commons.io.FileUtils;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
+import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
+
+import java.io.IOException;
+
+/**
+ * <p>
+ * A Seam component that handles file uploads for RichFace's file upload component. This class is a thin wrapper around
+ * {@link org.rhq.enterprise.gui.common.upload.FileUploadUIBean} which is not a Seam component.
+ * </p>
+ * <p>
+ * Currently this class is tightly coupled to {@link org.rhq.enterprise.gui.configuration.resource.RawConfigUIBean}
+ * which is specific to the raw config editor; however, this class can/should/will be generalized to support any file
+ * upload which is implemented using RichFaces and Seam together.
+ * </p>
+ */
+@Name("fileUploader")
+(a)Scope(ScopeType.PAGE)
+public class FileUploadComponent {
+
+ private FileUploadUIBean uploadBean = new FileUploadUIBean();
+
+ /**
+ * Represents the currently selected file in the raw config editor
+ */
+ @In
+ private RawConfigUIBean selectedRawUIBean;
+
+ public UploadItem getUploadItem() {
+ return uploadBean.getFileItem();
+ }
+
+ public void setUploadItem(UploadItem uploadItem) {
+ uploadBean.setFileItem(uploadItem);
+ }
+
+ /**
+ * This is the upload listener that handles consuming the uploaded file.
+ *
+ * @param event
+ * @throws Exception
+ */
+ public void listener(UploadEvent event) throws Exception {
+ uploadBean.fileUploadListener(event);
+ }
+
+ public void clear() {
+ uploadBean.clear();
+ }
+
+ /**
+ * Invoked when the upload has completed and updates {@link #selectedRawUIBean} with the contents of the uploaded
+ * file.
+ */
+ public void completeUpload() {
+ try {
+ if (uploadBean.getFileItem() != null) {
+ UploadItem fileItem = uploadBean.getFileItem();
+ if (fileItem.isTempFile()) {
+ selectedRawUIBean.setContents(FileUtils.readFileToString(fileItem.getFile()));
+ } else {
+ selectedRawUIBean.setContents(new String(fileItem.getData()));
+ }
+ uploadBean.clear();
+ }
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index af920cb..77c9525 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -25,6 +25,7 @@ package org.rhq.enterprise.gui.configuration.resource;
import org.apache.commons.io.FileUtils;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
@@ -36,6 +37,7 @@ import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
+import org.rhq.enterprise.gui.inventory.resource.ResourceUIBean;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -43,12 +45,13 @@ import org.richfaces.model.UploadItem;
import javax.faces.application.FacesMessage;
import java.io.IOException;
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@Name("configurationEditor")
@Scope(ScopeType.CONVERSATION)
-public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
+public class ResourceConfigurationEditor extends ResourceConfigurationViewer implements Serializable {
private Configuration originalResourceConfiguration;
@@ -59,9 +62,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
@RequestParameter
private String tab;
- @Out
- private FileUploadUIBean fileUploader = new FileUploadUIBean();
-
@Override
protected void doInitialization() {
if (tab != null) {
@@ -146,27 +146,9 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
return modifiedFiles.size() + " files changed in this configuration";
}
- public boolean isFileUploadAvailable() {
- return isRawSupported() || (isStructuredAndRawSupported() && isRawMode());
- }
-
- public String completeUpload() {
- try {
- if (fileUploader.getFileItem() != null) {
- UploadItem fileItem = fileUploader.getFileItem();
- if (fileItem.isTempFile()) {
- selectedRawUIBean.setContents(FileUtils.readFileToString(fileItem.getFile()));
- } else {
- selectedRawUIBean.setContents(new String(fileItem.getData()));
- }
- fileUploader.clear();
- }
-
- return null;
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ public boolean getRenderFileUpload() {
+ return isRawMode() && (isRawSupported() || isStructuredAndRawSupported());
+ }
public String updateConfiguration() {
ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
@@ -209,10 +191,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
rawConfigUIBean.undoEdit();
}
- /**
- *
- * @return
- */
public String finishAddMap() {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
return "success";
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index d8af346..a1d3c35 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -70,8 +70,7 @@ public class ResourceConfigurationViewer {
@Out(required = false)
protected RawConfigUIBean selectedRawUIBean;
- @RequestParameter("id")
- protected int resourceId;
+ protected Integer resourceId;
/**
* This method "bootstraps" the viewer/editor and the model objects used in the view. Specifically, the resource
@@ -80,9 +79,12 @@ public class ResourceConfigurationViewer {
*/
@Create
public void initialize() {
+ resourceId = FacesContextUtility.getRequiredRequestParameter("id", Integer.class);
+
loadResourceConfigurationDefinition();
loadResourceConfiguration();
initRawConfigDirectories();
+ initMode();
doInitialization();
}
@@ -154,6 +156,19 @@ public class ResourceConfigurationViewer {
return file.getParentFile().getAbsolutePath();
}
+ private void initMode() {
+ if (isStructuredSupported()) {
+ mode = STRUCTURED_MODE;
+ }
+ else if (isRawMode()) {
+ mode = RAW_MODE;
+ }
+ else { // else structured and raw is supported and (at least for now) we will just start
+ mode = STRUCTURED_MODE; // the user off in structured mode. We may at some later point want to add logic
+ // to remember what mode the user should start in.
+ }
+ }
+
/** @return <code>true</code> if the resource configuration supports raw only, <code>false</code> otherwise */
public boolean isRawSupported() {
return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.RAW;
@@ -172,6 +187,16 @@ public class ResourceConfigurationViewer {
return mode == RAW_MODE;
}
+ public boolean getRenderModalEditor() {
+ // Ideally we want to also check that isRawMode() returns true, but doing so causes the wrong results due to
+ // how/when the component tree is rendered. The mode field is changed when the user changes tabs in the UI;
+ // however this property is read and its value applied to the modalEditor component before the mode is updated.
+ //
+ // jsanda - 02/10/2010
+
+ return isRawSupported() || isStructuredAndRawSupported();
+ }
+
/**
* @return <code>true</code> if the resource configuration supports structured and raw, <code>false</code> otherwise
*/
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
index 599fc39..25b3dfe 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/inventory/resource/FavoritesUIBean.java
@@ -39,33 +39,47 @@ public class FavoritesUIBean {
private Boolean favorite; // true if this resource has been added to the favorites dashboard portlet
+ /**
+ * resourceUIBean is injected through JSF in inventory-beans.xml. ResourceUIBean is injected because this class
+ * needs access to the currently requested resource id, but the id is not available as a parameter with all
+ * requests, particularly with the raw config editor. The raw config editor however extends the life of the
+ * current ResourceUIBean beyond the current request so that the id can be accessed through ResourceUIBean.
+ */
+ private ResourceUIBean resourceUIBean;
+
public FavoritesUIBean() {
}
+ public ResourceUIBean getResourceUIBean() {
+ return resourceUIBean;
+ }
+
+ public void setResourceUIBean(ResourceUIBean resourceUIBean) {
+ this.resourceUIBean = resourceUIBean;
+ }
+
public boolean isFavorite() {
if (favorite == null) {
- log.debug("isFavorite for " + getResourceId());
- favorite = QuickFavoritesUtil.determineIfFavoriteResource(FacesContextUtility.getRequest());
+ log.debug("isFavorite for " + resourceUIBean.getId());
+ favorite = QuickFavoritesUtil.determineIfFavoriteResource(resourceUIBean.getId());
}
return favorite;
}
public String toggleFavorite() {
- log.debug("toggleFavorite for " + getResourceId());
+ log.debug("toggleFavorite for " + resourceUIBean.getId());
WebUser user = EnterpriseFacesContextUtility.getWebUser();
WebUserPreferences preferences = user.getWebPreferences();
WebUserPreferences.FavoriteResourcePortletPreferences favoriteResourcePreferences = preferences
.getFavoriteResourcePortletPreferences();
- int resourceId = WebUtility.getResourceId(FacesContextUtility.getRequest());
-
- boolean isFav = favoriteResourcePreferences.isFavorite(resourceId);
+ boolean isFav = favoriteResourcePreferences.isFavorite(resourceUIBean.getId());
if (isFav) {
- favoriteResourcePreferences.removeFavorite(resourceId);
- log.debug("Removing favorite: " + resourceId);
+ favoriteResourcePreferences.removeFavorite(resourceUIBean.getId());
+ log.debug("Removing favorite: " + resourceUIBean.getId());
} else {
- favoriteResourcePreferences.addFavorite(resourceId);
- log.debug("Adding favorite: " + resourceId);
+ favoriteResourcePreferences.addFavorite(resourceUIBean.getId());
+ log.debug("Adding favorite: " + resourceUIBean.getId());
}
preferences.setFavoriteResourcePortletPreferences(favoriteResourcePreferences);
@@ -75,7 +89,4 @@ public class FavoritesUIBean {
return null;
}
- private int getResourceId() {
- return WebUtility.getResourceId(FacesContextUtility.getRequest());
- }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/QuickFavoritesUtil.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/QuickFavoritesUtil.java
index 6e9acb9..28657ef 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/QuickFavoritesUtil.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/QuickFavoritesUtil.java
@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.LogFactory;
+import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.legacy.WebUser;
import org.rhq.enterprise.gui.legacy.WebUserPreferences;
import org.rhq.enterprise.gui.legacy.WebUserPreferences.FavoriteResourcePortletPreferences;
@@ -29,6 +30,7 @@ import org.rhq.enterprise.gui.legacy.util.SessionUtils;
import org.rhq.enterprise.gui.util.WebUtility;
public class QuickFavoritesUtil {
+
/**
* This not only returns the flag to indicate if the resource found in the request is a favorite, but it also adds
* an attribute "isFavorite" to the request so others can know the status later on down the request chain.
@@ -45,6 +47,14 @@ public class QuickFavoritesUtil {
return isFavorite;
}
+ public static Boolean determineIfFavoriteResource(int resourceId) {
+ HttpServletRequest request = FacesContextUtility.getRequest();
+ WebUser user = SessionUtils.getWebUser(request.getSession());
+ Boolean isFavorite = isFavorite(user, resourceId);
+ request.setAttribute("isFavorite", isFavorite);
+ return isFavorite;
+ }
+
public static Boolean determineIfFavoriteGroup(HttpServletRequest request, int groupId) {
WebUser user = SessionUtils.getWebUser(request.getSession());
Boolean isFavorite = isFavoriteGroup(user, groupId);
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index 2042013..5997637 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@ -10,32 +10,20 @@
<component name="org.jboss.seam.core.init">
- <property name="debug">false</property> <!-- enable only when needed -->
+ <property name="debug">true</property> <!-- enable only when needed -->
<property name="transactionManagementEnabled">false</property>
<property name="jndiPattern">rhq/#{ejbName}/local</property>
</component>
- <component class="org.jboss.seam.web.MultipartFilter">
- <property name="createTempFiles">true</property>
- <property name="maxRequestSize">1000000</property>
- <property name="urlPattern">*.xhtml</property>
- </component>
-
- <component class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
- name="ExistingResourceConfigurationViewUIBean"
- scope="page"/>
-
- <component class="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"
- name="ExistingResourceConfigurationUIBean"
- scope="session"/>
-
- <!-- Load i18n bundles -->
+ <!-- Load i18n bundles -->
<core:resource-loader>
<core:bundle-names>
<value>messages</value>
<value>ApplicationResources</value>
</core:bundle-names>
- </core:resource-loader>
+ </core:resource-loader>
+
+ <core:manager conversation-timeout="180000" concurrent-request-timeout="10000"/>
</components>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
index bed651d..628f694 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-managed-beans/inventory-beans.xml
@@ -18,11 +18,7 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
- <managed-bean>
- <managed-bean-name>FavoritesUIBean</managed-bean-name>
- <managed-bean-class>org.rhq.enterprise.gui.inventory.resource.FavoritesUIBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+
<!-- /rhq/admin/listAlertTemplates.xhtml & others -->
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 977ed54..43331bf 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -17,21 +17,16 @@
<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
- <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="5000" >
+ <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="10000" timeout="180000">
<action execute="#{configurationEditor.initialize}"
on-postback="false"
if="#{!conversation.longRunning or (empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id)}"/>
- <!--<action execute="#{configurationEditor.initialize}" on-postback="false"/>-->
-
- <!--<begin-conversation join="true" if="#{!conversation.longRunning}"/>-->
-
- <!--<begin-conversation if="#{empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id}"/>-->
<navigation from-action="#{configurationEditor.initialize}">
<begin-conversation join="true"/>
<rule if="#{configurationEditor.updateInProgress}">
<redirect view-id="/rhq/resource/configuration/view.xhtml" include-page-params="true">
- <param name="id" value="#{ResourceUIBean.id}"/>
+ <param name="id" value="#{ResourceUIBean.id}"/>
</redirect>
</rule>
</navigation>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index d9e4078..88c78d1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -5,7 +5,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
- <display-name>RHQ_FOO</display-name>
+ <display-name>RHQ</display-name>
<!--=== Seam ===-->
@@ -18,6 +18,14 @@
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ <init-param>
+ <param-name>createTempFiles</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>maxRequestSize</param-name>
+ <param-value>250000000</param-value>
+ </init-param>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 7448990..f5be7d0 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -71,7 +71,7 @@ THIS TEXT WILL BE REMOVED.
<c:choose>
<c:when test="${configurationEditor.rawSupported}">
- <rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
+ <rich:tabPanel>
<rich:tab label="Advanced Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<ui:include src="raw.xhtml">
<ui:param name="readOnly" value="false"/>
@@ -81,7 +81,7 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when test="${configurationEditor.structuredSupported}">
- <rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
+ <rich:tabPanel>
<rich:tab label="Basic Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<ui:include src="structured.xhtml">
<ui:param name="readOnly" value="false"/>
@@ -108,7 +108,7 @@ THIS TEXT WILL BE REMOVED.
valueChangeListener="#{configurationEditor.changeTabs}">
<rich:tab id="structuredTab"
label="Basic Mode"
- reRender="upperCommitPanel"
+ reRender="lowerCommitPanel,upperCommitPanel,modalEditor"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<ui:include src="structured.xhtml">
@@ -117,7 +117,7 @@ THIS TEXT WILL BE REMOVED.
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
- reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
+ reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel,modalEditor"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<ui:include src="raw.xhtml">
@@ -142,12 +142,17 @@ THIS TEXT WILL BE REMOVED.
</h:panelGroup>
</h:panelGrid>
- <ui:include src="upload-modal.xhtml"/>
<ui:include src="view-raw-modal.xhtml">
<ui:param name="readOnly" value="false"/>
</ui:include>
</h:form>
+ <!--
+ upload-modal.xhtml needs to be included outside the above form because the file upload component requires its
+ own, separate form.
+ -->
+ <ui:include src="upload-modal.xhtml"/>
+
<h:panelGroup layout="block" styleClass="InfoBlock"
rendered="#{configurationEditor.updateInProgress}">
<b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 6b87226..dc5ca86 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -33,7 +33,8 @@
<rich:panel id="fileMenuPanel" style="width:100%; background-color: rgb(217, 223, 227);">
<h:outputLabel value="Files" style="font-weight: bold; padding-left: 5px;"/>
<ui:remove><f:facet name="header">Files</f:facet></ui:remove>
- <rich:panelMenu mode="ajax"
+ <rich:panelMenu id="fileMenu"
+ mode="ajax"
expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
iconExpandedGroup="/images/icn_tree_folder.gif"
@@ -117,7 +118,7 @@
<a4j:status id="selectedFileHeader"
startText="Loading #{selectedRawUIBean.path} ..."
stopText="#{selectedRawUIBean.path}"
- startStyleClass="rawConfigFileHeader"
+ startStyleClass="rawConfgFileHeader"
stopStyleClass="rawConfigFileHeader"/>
</h:panelGrid>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
index 6a412a1..f030db7 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
@@ -8,52 +8,60 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <f:subview id="uploadSubview">
-
- <script type="text/javascript">
- function prepareFormForUpload() {
- var form = document.getElementById('editResourceConfigurationForm');
- form.encoding = 'multipart/form-data';
-
- return true;
- }
- </script>
-
- <rich:modalPanel id="uploadWindow" width="800" height="400">
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="#{selectedRawUIBean.path}"/>
- </h:panelGroup>
- </f:facet>
- <f:facet name="controls">
- <h:panelGroup>
- <h:graphicImage value="/images/close.png" styleClass="hidelink" id="hidelink"/>
- <rich:componentControl for="uploadWindow" attachTo="hidelink" operation="hide" event="onclick"/>
- </h:panelGroup>
- </f:facet>
-
-
- <rich:panel id="uploadPanel">
-
- <input type="hidden" name="currentResourceId" value="#{ResourceUIBean.id}"/>
-
- <rich:fileUpload id="fileUpload"
- listHeight="50px"
- fileUploadListener="#{fileUploader.fileUploadListener}"
- addControlLabel="Browse"
- immediateUpload="false"
- onupload="prepareFormForUpload()">
- <f:facet name="label">
- <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"/>
- </f:facet>
- <a4j:support event="onuploadcomplete"
- action="#{configurationEditor.completeUpload}"
- reRender="fileUpload,fileContents,fileMenu"
- onsubmit="#{rich:component('uploadWindow')}.hide()"/>
- </rich:fileUpload>
-
- </rich:panel>
- </rich:modalPanel>
- </f:subview>
+ <rich:modalPanel id="uploadWindow" width="800" height="400" rendered="#{configurationEditor.renderFileUpload}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="#{selectedRawUIBean.path}"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/close.png" styleClass="hidelink" id="hideUploadModalLink"/>
+ <rich:componentControl for="uploadWindow" attachTo="hideUploadModalLink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+
+ <!--
+ Note that the form *must* being nested inside the modalPanel; otherwise, the file upload listener is not invoked.
+ This was discovered through trial and error along this jira (https://jira.jboss.org/jira/browse/RF-3492).
+ -->
+ <h:form id="uploadForm">
+ <ui:remove>
+ <!--
+ Adding the keepAlive here for ResourceUIBean so that the current instance of ResourceUIBean lives across
+ upload requests. There are a number of places that look for and expect to find the id request parameter. Even
+ though the file upload is done via an ajax request, things still break down without the id parameter because
+ ajax requests still trigger the JSF lifecycle, and that id parameter is expected in various places during the
+ update model phase.
+
+ With a file upload submission, richfaces sets the form's enctype attribute to multipart/form-data which prevents
+ other input values from being submitted with the form. Along with a bit of refactoring and the keepAlive for
+ ResourceUIBean, we are able to circumvent the need for passing the id parameter.
+
+ jsanda - 02/10/2010
+ -->
+ </ui:remove>
+ <a4j:keepAlive beanName="ResourceUIBean"/>
+
+ <rich:panel id="uploadPanel">
+ <rich:fileUpload id="fileUpload"
+ listHeight="50px"
+ fileUploadListener="#{fileUploader.listener}"
+ noDuplicates="true"
+ allowFlash="false"
+ addControlLabel="Browse"
+ immediateUpload="false">
+ <f:facet name="label">
+ <h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"/>
+ </f:facet>
+ <a4j:support event="onuploadcomplete"
+ action="#{fileUploader.completeUpload}"
+ limitToList="true"
+ reRender="fileContents,fileMenu,fileUpload,modalEditor"
+ onsubmit="#{rich:component('uploadWindow')}.hide()"/>
+ </rich:fileUpload>
+ </rich:panel>
+ </h:form>
+ </rich:modalPanel>
</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index 5949b58..75cf462 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -22,40 +22,38 @@
</c:otherwise>
</c:choose>
- <f:subview id="modalEditorSubview" rendered="#{editor.rawSupported or editor.structuredAndRawSupported}">
- <rich:modalPanel id="modalEditor" width="800" height="600">
- <f:facet name="header">
- <h:panelGroup>
- <h:outputText value="#{editor.modalEditorHeader}" styleClass="rawConfigFileHeader"/>
- </h:panelGroup>
- </f:facet>
- <f:facet name="controls">
- <h:panelGroup>
- <h:graphicImage value="/images/close.png" styleClass="hidelink" id="hidelink"/>
- <rich:componentControl for="modalEditor" attachTo="hidelink" operation="hide" event="onclick"/>
- </h:panelGroup>
- </f:facet>
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="modalFileContents"
- styleClass="rawConfigFileContents"
- style="width:100%; height:100%; overflow:visible;"
- rows="30"
- cols="30"
- value="#{editor.modalEditorContents}"
- readonly="#{readOnly}"/>
- </rich:panel>
- <h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
- <h:panelGroup style="text-align:right">
- <a4j:commandButton value="Save"
- action="#{configurationEditor.applyModalEditContents}"
- rendered="#{!readOnly}"
- reRender="fileContents,fileMenuPanel,lowerChangedFilesLabel,upperChangedFilesLabel"
- styleClass="buttonmed"
- onclick="#{rich:component('modalEditor')}.hide()"/>
- <a4j:commandButton value="Cancel" onclick="#{rich:component('modalEditor')}.hide()" styleClass="buttonmed"/>
- </h:panelGroup>
- </h:panelGrid>
- </rich:modalPanel>
- </f:subview>
+ <rich:modalPanel id="modalEditor" width="800" height="600" rendered="#{editor.renderModalEditor}">
+ <f:facet name="header">
+ <h:panelGroup>
+ <h:outputText value="#{editor.modalEditorHeader}" styleClass="rawConfigFileHeader"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="controls">
+ <h:panelGroup>
+ <h:graphicImage value="/images/close.png" styleClass="hidelink" id="hideModalEditorLink"/>
+ <rich:componentControl for="modalEditor" attachTo="hideModalEditorLink" operation="hide" event="onclick"/>
+ </h:panelGroup>
+ </f:facet>
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="modalFileContents"
+ styleClass="rawConfigFileContents"
+ style="width:100%; height:100%; overflow:visible;"
+ rows="30"
+ cols="30"
+ value="#{editor.modalEditorContents}"
+ readonly="#{readOnly}"/>
+ </rich:panel>
+ <h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
+ <h:panelGroup style="text-align:right">
+ <a4j:commandButton value="Save"
+ action="#{configurationEditor.applyModalEditContents}"
+ rendered="#{!readOnly}"
+ reRender="fileContents,fileMenuPanel,lowerChangedFilesLabel,upperChangedFilesLabel"
+ styleClass="buttonmed"
+ onclick="#{rich:component('modalEditor')}.hide()"/>
+ <a4j:commandButton value="Cancel" onclick="#{rich:component('modalEditor')}.hide()" styleClass="buttonmed"/>
+ </h:panelGroup>
+ </h:panelGrid>
+ </rich:modalPanel>
</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 6b336ab..e50c592 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -62,8 +62,7 @@ THIS TEXT WILL BE REMOVED.
<c:choose>
<c:when test="${configurationViewer.rawSupported}">
-
- <rich:tabPanel switchType="ajax">
+ <rich:tabPanel>
<rich:tab label="Advanced Mode">
<ui:include src="raw.xhtml"/>
</rich:tab>
@@ -71,7 +70,7 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when test="${configurationViewer.structuredSupported}">
- <rich:tabPanel switchType="ajax">
+ <rich:tabPanel>
<rich:tab label="Basic Mode">
<ui:include src="structured.xhtml"/>
</rich:tab>
@@ -87,7 +86,7 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,lowerEditButton">
+ reRender="upperEditButton,lowerEditButton,modalEditor">
<ui:include src="structured.xhtml"/>
</rich:tab>
<rich:tab id="rawTab"
@@ -95,15 +94,13 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,lowerEditButton">
+ reRender="upperEditButton,lowerEditButton,modalEditor">
<ui:include src="raw.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
</c:choose>
- <ui:include src="view-raw-modal.xhtml"/>
-
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
<s:button id="lowerEditButton"
@@ -116,6 +113,8 @@ THIS TEXT WILL BE REMOVED.
</s:button>
</h:panelGroup>
</h:panelGrid>
+
+ <ui:include src="view-raw-modal.xhtml"/>
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
commit 2a0e531cad3bad14a706169370eec24eac7218d8
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Feb 10 11:22:35 2010 -0500
Added the cobbler plugin to the dist ear pom file
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index bb2ff06..4ae7211 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -250,6 +250,12 @@
<artifactId>rhq-augeas-plugin</artifactId>
<version>${project.version}</version>
</artifactItem>
+
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-cobbler-plugin</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
commit 44e7036ce4509cb4b3bacad3584ff609353675d7
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 10 13:54:34 2010 +0100
Disambiguate the package names by prepending them with plugin and resource type name for display purposes.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
index 4e4558e..6070774 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageType.java
@@ -71,7 +71,7 @@ import org.rhq.core.domain.resource.ResourceType;
+ "JOIN pt.resourceType rt "
+ "LEFT JOIN FETCH pt.deploymentConfigurationDefinition cd "
+ "LEFT JOIN FETCH cd.templates cts " + "WHERE rt.id = :typeId AND pt.isCreationData = true"),
- @NamedQuery(name = PackageType.QUERY_DYNAMIC_CONFIG_VALUES, query = "SELECT pt.displayName, pt.name FROM PackageType AS pt")
+ @NamedQuery(name = PackageType.QUERY_DYNAMIC_CONFIG_VALUES, query = "SELECT pt.resourceType.plugin || ' - ' || pt.resourceType.name || ' - ' || pt.displayName, pt.name FROM PackageType AS pt")
})
@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_PACKAGE_TYPE_ID_SEQ")
@Table(name = "RHQ_PACKAGE_TYPE")
commit ee799ca49d3bcd05d1b2953d19e2093c3d74edc6
Merge: 2fd2c1d... 3640fd8...
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 22:21:26 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 2fd2c1d84a43e003ccf1dfa38358b11271f4e1fc
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 22:20:44 2010 -0500
Upgrading groovy to latest version
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index 60eef55..e599765 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -23,7 +23,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.6.4</version>
+ <version>1.7.0</version>
</dependency>
<dependency>
@@ -72,7 +72,7 @@
<artifactItem>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.6.4</version>
+ <version>1.7.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
commit 7761923037155f94593e520c6ca21300b4b7fd04
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 22:30:51 2010 +0100
Fix link to alert definitions.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
index 6c707b3..1b1c04b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
@@ -20,7 +20,7 @@
<tr valign="top">
<td width="20%" class="BlockLabel"><fmt:message key="common.label.Name"/></td>
<td width="30%" class="BlockContent"><c:out value="${alertDef.name}"/><c:if test="${not empty Resource}"><br>
- <html:link page="/alerts/Config.do?mode=viewRoles&id=${Resource.id}&ad=${alertDef.id}"><fmt:message key="alert.config.props.PB.ViewDef"/></html:link></c:if></td>
+ <html:link page="/rhq/resource/alert/viewAlert.xhtml?id=${Resource.id}&ad=${alertDef.id}"><fmt:message key="alert.config.props.PB.ViewDef"/></html:link></c:if></td>
<td width="20%" class="BlockLabel"><fmt:message key="alert.config.props.PB.Priority"/></td>
<td width="30%" class="BlockContent" colspan="2">
<c:out value="${alertDef.priority.displayName}" />
commit 112e42e89e5328b727563aa4fea562c221b3c287
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 22:25:35 2010 +0100
Better formatting of the emails lists.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index b21ed0f..c321422 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -22,6 +22,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
@@ -69,6 +70,7 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.core.domain.util.PersistenceUtility;
+import org.rhq.core.domain.util.StringUtils;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
@@ -695,7 +697,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
if (result.getEmails() != null && !result.getEmails().isEmpty()) {
emailAddresses.addAll(result.getEmails());
alNoLo.setTranisentEmails(result.getEmails());
- alNoLo.setAllEmails(result.getEmails().toString());
+ alNoLo.setAllEmails(StringUtils.getListAsString(result.getEmails(),","));
}
} else {
alNoLo = new AlertNotificationLog(alert, senderName, result);
@@ -730,16 +732,15 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
if (!(anl.getResultState() == ResultState.DEFERRED_EMAIL))
continue;
- StringBuilder b = new StringBuilder();
+ List<String> badList = new ArrayList<String>();
for (String badOne : badAddresses) {
if (anl.getTranisentEmails().contains(badOne)) {
anl.setResultState(ResultState.FAILED_EMAIL);
- b.append(badOne);
- b.append(", ");
+ badList.add(badOne);
}
}
if (anl.getResultState()==ResultState.FAILED_EMAIL)
- anl.setBadEmails(b.toString());
+ anl.setBadEmails(StringUtils.getListAsString(badList,","));
}
}
commit 4b4af8fe63d7d76cea204947656191e091572f4e
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 22:09:51 2010 +0100
Those are no longer needed.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsRoles.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsRoles.jsp
deleted file mode 100644
index 495e149..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsRoles.jsp
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-
- <tr valign="top">
- <td width="20%" class="BlockLabel" valign="top"><fmt:message key="alert.current.detail.notify.Roles"/></td>
- <tiles:insert definition=".events.alert.view.notifications.list">
- <tiles:put name="listObjectProperty" value="${alert.alertNotificationLog.roles}"/>
- </tiles:insert>
- </tr>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsUsers.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsUsers.jsp
deleted file mode 100644
index 102406a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotificationsUsers.jsp
+++ /dev/null
@@ -1,11 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-
- <tr valign="top">
- <td width="20%" class="BlockLabel" valign="top"><fmt:message key="alert.current.detail.notify.CAM"/></td>
- <tiles:insert definition=".events.alert.view.notifications.list">
- <tiles:put name="listObjectProperty" value="${alert.alertNotificationLog.subjects}"/>
- </tiles:insert>
- </tr>
commit e1d2fc406ef6a6248601262da75106db90e0a488
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 22:09:35 2010 +0100
Optimize l&f
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
index 25287be..ede7a27 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
@@ -11,20 +11,28 @@
<!-- Notification Content -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
- Details of fired alerts go here
-
<c:choose>
<c:when test="${not empty aNotifLogs }">
+ <thead>
+ <td class="BlockLeftAlignLabel" width="10%">Sender</td>
+ <td class="BlockLeftAlignLabel" width="10%">Result</td>
+ <td class="BlockLeftAlignLabel" width="30%">Message</td>
+ <td class="BlockLeftAlignLabel" width="25%">All emails</td>
+ <td class="BlockLeftAlignLabel" width="25%">Failed emails</td>
+ </thead>
<c:forEach var="notif" items="${aNotifLogs}">
- <c:out value="${notif.sender}"/>
- <br/>
- <c:out value="${notif.message}"/>
+ <tr valign="top">
+ <td class="BlockContent"><c:out value="${notif.sender}"/></td>
+ <td class="BlockContent"><c:out value="${notif.resultState}"/></td>
+ <td class="BlockContent"><c:out value="${notif.message}"/></td>
+ <td class="BlockContent"><c:out value="${notif.allEmails}"/></td>
+ <td class="BlockContent"><c:out value="${notif.badEmails}"/></td>
<p/>
-
+ </tr>
</c:forEach>
</c:when>
<c:otherwise>
- No notifications were specified
+ <strong>No notifications were specified for this alert's definition</strong>
</c:otherwise>
</c:choose>
</table>
commit ede4e66f585d8975da1e226a51e4d46df41762a6
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 21:51:09 2010 +0100
Bring back display of alert notification logs.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
index ff25239..a62d785 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
@@ -39,7 +39,6 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@@ -234,7 +233,7 @@ public class Alert implements Serializable {
private Set<AlertConditionLog> conditionLogs = new LinkedHashSet<AlertConditionLog>();
@OneToMany(mappedBy = "alert", cascade = CascadeType.ALL)
- private List<AlertNotificationLog> alertNotificationLog = new ArrayList<AlertNotificationLog>();
+ private List<AlertNotificationLog> alertNotificationLogs = new ArrayList<AlertNotificationLog>();
@Deprecated
@Column(name = "TRIGGERED_OPERATION", nullable = true)
@@ -258,8 +257,6 @@ public class Alert implements Serializable {
@ManyToOne
private Subject ackBy;
-
-
/**
* Creates a new alert. (required by EJB3 spec, but not used)
*/
@@ -310,16 +307,16 @@ public class Alert implements Serializable {
conditionLog.setAlert(this);
}
- public List<AlertNotificationLog> getAlertNotificationLog() {
- return alertNotificationLog;
+ public List<AlertNotificationLog> getAlertNotificationLogs() {
+ return alertNotificationLogs;
}
- public void setAlertNotificationLog(List<AlertNotificationLog> alertNotificationLog) {
- this.alertNotificationLog = alertNotificationLog;
+ public void setAlertNotificationLogs(List<AlertNotificationLog> alertNotificationLogs) {
+ this.alertNotificationLogs = alertNotificationLogs;
}
public void addAlertNotificatinLog(AlertNotificationLog log) {
- this.alertNotificationLog.add(log);
+ this.alertNotificationLogs.add(log);
}
public String getTriggeredOperation() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index d7ee950..409f6f2 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -51,16 +51,16 @@ import org.rhq.core.domain.alert.Alert;
@NamedQueries( {
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_ALERT_CTIME, //
query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
- "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an WHERE a.ctime BETWEEN :begin AND :end)"),
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLogs an WHERE a.ctime BETWEEN :begin AND :end)"),
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_RESOURCE, //
query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
- "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an JOIN a.alertDefinition def " +
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLogs an JOIN a.alertDefinition def " +
"WHERE def.resource.id = :resourceId)"),
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_RESOURCES, //
query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
- "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an JOIN a.alertDefinition def " +
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLogs an JOIN a.alertDefinition def " +
"WHERE def.resource.id IN ( :resourceIds ) )")
})
@SequenceGenerator(name = "RHQ_ALERT_NOTIF_LOG_ID_SEQ", sequenceName = "RHQ_ALERT_NOTIF_LOG_ID_SEQ")
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
index 0aa06e3..b08a41c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/ViewAlertAction.java
@@ -42,6 +42,7 @@ import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionCategory;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.util.MeasurementConverter;
@@ -129,6 +130,11 @@ public class ViewAlertAction extends TilesAction {
request.setAttribute("conditionExpression", adv.getConditionExpression().name());
request.setAttribute("alertDefConditions", alertCondBeans);
+
+ List<AlertNotificationLog> notificationLogs = av.getAlertNotificationLogs() ;
+
+ request.setAttribute("aNotifLogs",notificationLogs);
+
request.setAttribute("controlEnabled", true); // always display control result, even if it's "none"
if (av.getTriggeredOperation() != null) {
request.setAttribute("controlAction", av.getTriggeredOperation());
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
index 633855a..25287be 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
@@ -2,6 +2,7 @@
<%@ page errorPage="/common/Error.jsp" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!-- Content Block Title: Notification -->
<tiles:insert definition=".header.tab">
@@ -11,4 +12,19 @@
<!-- Notification Content -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
Details of fired alerts go here
+
+ <c:choose>
+ <c:when test="${not empty aNotifLogs }">
+ <c:forEach var="notif" items="${aNotifLogs}">
+ <c:out value="${notif.sender}"/>
+ <br/>
+ <c:out value="${notif.message}"/>
+ <p/>
+
+ </c:forEach>
+ </c:when>
+ <c:otherwise>
+ No notifications were specified
+ </c:otherwise>
+ </c:choose>
</table>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index fcc5fb8..b21ed0f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -536,6 +536,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
log.getCondition().getMeasurementDefinition().getId();
}
}
+ alert.getAlertNotificationLogs().size();
}
private void fetchCollectionFields(List<Alert> alerts) {
@@ -725,7 +726,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
// log those bad addresses to the gui and their individual senders (if possible)
if (!badAddresses.isEmpty()) {
- for (AlertNotificationLog anl : alert.getAlertNotificationLog()) {
+ for (AlertNotificationLog anl : alert.getAlertNotificationLogs()) {
if (!(anl.getResultState() == ResultState.DEFERRED_EMAIL))
continue;
commit 3640fd8653364bf637126c691d2fb527bacd5870
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 9 12:35:23 2010 -0500
Removed call to wrap the Exception to test changes to PluginContainerException.
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 3e41847..3506512 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
@@ -347,7 +347,7 @@ public class ConfigurationManager extends AgentService implements ContainerServi
} catch (IllegalArgumentException e) {
thereAreErrors = true;
} catch (Throwable t) {
- throw new PluginContainerException(t.getMessage(), new WrappedRemotingException(t));
+ throw new PluginContainerException(t.getMessage(), t);
}
} else {
for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
commit 76a0293046a8280705ec0aaf822615712ab61052
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 9 12:34:29 2010 -0500
Reordered checks to make code clearer and put most likely case up top.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
index f94f643..c299d97 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
@@ -43,7 +43,10 @@ public class PluginContainerException extends Exception {
private static final long serialVersionUID = 1L;
private static Throwable wrapIfNecessary(Throwable e){
- // we assume everyone has java.* exception definitions available
+
+ if (e.getClass().equals(WrappedRemotingException.class)) return e;
+
+ // we assume everyone has java.* exception definitions available
// see if the exception and all its causes are all java.* exceptions
Throwable check_for_java = e;
boolean all_java_exceptions = true; // if false, e or one of its causes is not a java.* exception
@@ -61,9 +64,8 @@ public class PluginContainerException extends Exception {
}
}
- // if the exception and all its causes are java.*, then just return e as-is, unless its not serializable
+ // if the exception and all its causes are java.*, then just return e as-is
if (!all_java_exceptions) {
- if (e.getClass().equals(WrappedRemotingException.class)) return e;
return new WrappedRemotingException(e);
}
return e;
commit fa34479a7b8a32f5d46c0e07bbe9707bce05696b
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 9 12:02:22 2010 -0500
Makinbg the Plugin Container Exception capable of handling the wrapping of Exceptions for marshalling.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
index 1b89ec7..f94f643 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
@@ -27,6 +27,8 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import org.rhq.core.util.exception.WrappedRemotingException;
+
/**
* This generic exception thrown by the plugin container is part of its client API; thus this exception is available to
* both the plugin container as well as its remote clients.
@@ -40,6 +42,34 @@ import java.util.List;
public class PluginContainerException extends Exception {
private static final long serialVersionUID = 1L;
+ private static Throwable wrapIfNecessary(Throwable e){
+ // we assume everyone has java.* exception definitions available
+ // see if the exception and all its causes are all java.* exceptions
+ Throwable check_for_java = e;
+ boolean all_java_exceptions = true; // if false, e or one of its causes is not a java.* exception
+
+ while (check_for_java != null) {
+ if (!check_for_java.getClass().getName().startsWith("java.")) {
+ all_java_exceptions = false;
+ break; // don't bother continuing, we found a non-java.* exception
+ }
+
+ if (check_for_java.getCause() == check_for_java) {
+ check_for_java = null; // reached the end of the causes chain
+ } else {
+ check_for_java = check_for_java.getCause();
+ }
+ }
+
+ // if the exception and all its causes are java.*, then just return e as-is, unless its not serializable
+ if (!all_java_exceptions) {
+ if (e.getClass().equals(WrappedRemotingException.class)) return e;
+ return new WrappedRemotingException(e);
+ }
+ return e;
+ }
+
+
/**
* Because this exception is part of the plugin container's client API and thus is to be available on remote clients
* as well, make sure the <code>cause</code> throwable you pass to this constructor is also available to remote
@@ -49,7 +79,7 @@ public class PluginContainerException extends Exception {
* @see Throwable#Throwable(Throwable)
*/
public PluginContainerException(Throwable cause) {
- super(cause);
+ super(wrapIfNecessary(cause));
}
/**
@@ -61,7 +91,7 @@ public class PluginContainerException extends Exception {
* @see Throwable#Throwable(String, Throwable)
*/
public PluginContainerException(String message, Throwable cause) {
- super(message, cause);
+ super(message, wrapIfNecessary(cause));
}
/**
commit 250b58d31678aeaf2c7f5d3c0c726a897d9d54f0
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 11:45:39 2010 -0500
Adding a navigation rule and rendering logic to handle a request for a configurtion that already has an update in progress
If a user navigates to view.xhtml and an update is in progress, the edit buttons are not rendered.
If a request for edit.xhtml is made while an update is in progress, the user is redirected back
to view.xhtml.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index eec0dd8..977ed54 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -17,9 +17,24 @@
<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
- <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="3000">
- <action execute="#{configurationEditor.initialize}" on-postback="false"/>
- <begin-conversation join="true"/>
+ <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="5000" >
+ <action execute="#{configurationEditor.initialize}"
+ on-postback="false"
+ if="#{!conversation.longRunning or (empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id)}"/>
+ <!--<action execute="#{configurationEditor.initialize}" on-postback="false"/>-->
+
+ <!--<begin-conversation join="true" if="#{!conversation.longRunning}"/>-->
+
+ <!--<begin-conversation if="#{empty resourceConfiguration or resourceConfiguration.id ne ResourceUIBean.id}"/>-->
+
+ <navigation from-action="#{configurationEditor.initialize}">
+ <begin-conversation join="true"/>
+ <rule if="#{configurationEditor.updateInProgress}">
+ <redirect view-id="/rhq/resource/configuration/view.xhtml" include-page-params="true">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ </redirect>
+ </rule>
+ </navigation>
<navigation from-action="#{configurationEditor.updateConfiguration}">
<rule if-outcome="success">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 4c75324..6b87226 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -30,8 +30,9 @@
cellpadding="0"
cellspacing="0"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel id="fileMenuPanel" style="width:100%">
- <f:facet name="header">Files</f:facet>
+ <rich:panel id="fileMenuPanel" style="width:100%; background-color: rgb(217, 223, 227);">
+ <h:outputLabel value="Files" style="font-weight: bold; padding-left: 5px;"/>
+ <ui:remove><f:facet name="header">Files</f:facet></ui:remove>
<rich:panelMenu mode="ajax"
expandMode="client"
iconCollapsedGroup="/images/icn_tree_folder.gif"
@@ -57,27 +58,6 @@
<c:otherwise>
<rich:panelMenuItem label=""
icon="#{rawConfigUIBean.icon}">
- <ui:remove>
- <rich:layout>
- <rich:layoutPanel position="left">
- <h:outputLabel value="#{rawConfigUIBean.fileName}">
- <a4j:support event="onmousedown"
- onsubmit="cursor_wait()"
- oncomplete="cursor_clear()"
- action="#{configurationEditor.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel,uploadWindow"/>
- </h:outputLabel>
- </rich:layoutPanel>
- <rich:layoutPanel position="right">
- <a4j:commandButton value="Undo"
- styleClass="rawConfigUndoButton"
- rendered="#{rawConfigUIBean.modified}"
- action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
- </rich:layoutPanel>
- </rich:layout>
- </ui:remove>
<h:panelGrid columns="2" columnClasses="rawConfigFileNameCol, rawConfigUndoCol">
<h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onmousedown"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 5156852..6b336ab 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -48,7 +48,11 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <s:button id="upperEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <s:button id="upperEditButton"
+ value="Edit"
+ view="edit.xhtml"
+ styleClass="buttonmed"
+ rendered="#{!configurationViewer.updateInProgress}">
<f:param name="id" value="#{ResourceUIBean.id}"/>
<f:param name="tab" value="#{configurationViewer.selectedTab}"/>
</s:button>
@@ -102,7 +106,11 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <s:button id="lowerEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <s:button id="lowerEditButton"
+ value="Edit"
+ view="edit.xhtml"
+ styleClass="buttonmed"
+ rendered="#{!configurationViewer.updateInProgress}">
<f:param name="id" value="#{ResourceUIBean.id}"/>
<f:param name="tab" value="#{configurationViewer.selectedTab}"/>
</s:button>
commit 71288bd44ae3632128bc437aa9e179b2701ace19
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 9 17:42:33 2010 +0100
Finished the seemingly unfinished javadoc...
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index f6d9da8..fb37744 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -440,7 +440,14 @@ public interface ResourceManagerLocal {
Resource getParentResource(Subject subject, int resourceId);
/**
- * Given a list of results, this method produces
+ * Given a list of results, this method produces an object decorates the provided original results
+ * with data needed to disambiguate the results with respect to resource names, their types and ancestory.
+ * <p>
+ * The disambiguation result contains information on what types of information are needed to make the resources
+ * in the original result unambiguous and contains the decorated original data in the same order as the
+ * supplied result list.
+ *
+ * @see ResourceNamesDisambiguationResult
*
* @param <T> the type of the result elements
* @param results the results to disambiguate
commit 53a20b8a9b2c7daecc6f2333f92917364ec679c7
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 2 13:49:08 2010 +0100
alert definitions subsystem page uses resource names disambiguation.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
index 80b33db..4d656b5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertDefinitionUIBean.java
@@ -37,9 +37,11 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.converter.SelectItemUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
@@ -69,6 +71,13 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
private String categoryFilter;
private SelectItem[] categoryFilterItems;
+ private IntExtractor<AlertDefinitionComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<AlertDefinitionComposite>() {
+
+ public int extract(AlertDefinitionComposite object) {
+ return object.getAlertDefinition().getResource().getId();
+ }
+ };
+
public SubsystemAlertDefinitionUIBean() {
datePattern = EnterpriseFacesContextUtility.getWebUser().getWebPreferences().getDateTimeDisplayPreferences()
.getDateTimeFormatTrigger();
@@ -176,13 +185,13 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
return dataModel;
}
- private class ResultsDataModel extends PagedListDataModel<AlertDefinitionComposite> {
+ private class ResultsDataModel extends ResourceNameDisambiguatingPagedListDataModel<AlertDefinitionComposite> {
public ResultsDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
@Override
- public PageList<AlertDefinitionComposite> fetchPage(PageControl pc) {
+ public PageList<AlertDefinitionComposite> fetchDataForPage(PageControl pc) {
getDataFromRequest();
String resourceFilter = getResourceFilter();
@@ -215,6 +224,10 @@ public class SubsystemAlertDefinitionUIBean extends SubsystemView {
return result;
}
+ protected IntExtractor<AlertDefinitionComposite> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
+
private void getDataFromRequest() {
SubsystemAlertDefinitionUIBean outer = SubsystemAlertDefinitionUIBean.this;
outer.resourceFilter = FacesContextUtility.getOptionalRequestParameter(FORM_PREFIX + "resourceFilter");
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
index 8d3cb0b..a632467 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertDefinitions.xhtml
@@ -90,7 +90,7 @@
</f:facet>
<onc:select name="selectedItems"
- value="#{item.alertDefinition.id}" />
+ value="#{item.original.alertDefinition.id}" />
</rich:column>
<rich:column>
@@ -101,33 +101,27 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{item.alertDefinition.resource.id}" />
- <h:outputText value="#{item.alertDefinition.resource.name}" />
+ <f:param name="id" value="#{item.original.alertDefinition.resource.id}" />
+ <h:outputText value="#{item.original.alertDefinition.resource.name}" />
</h:outputLink>
</rich:column>
<rich:column>
<f:facet name="header">
- <onc:sortableColumnHeader sort="parent.name">
- <h:outputText styleClass="headerText" value="Parent" />
- </onc:sortableColumnHeader>
+ <h:outputText styleClass="headerText" value="Parent" />
</f:facet>
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}"
- rendered="#{not empty item.parentResourceName}">
- <f:param name="id" value="#{item.parentResourceId}" />
- <h:outputText value="#{item.parentResourceName}" />
- </h:outputLink>
+ <onc:resourcePartialLineage parents="#{item.parents}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Type" />
</f:facet>
- <h:outputText value="Group Alert Definition" rendered="#{not empty item.alertDefinition.resourceGroup}" />
- <h:outputText value="Alert Template" rendered="#{not empty item.alertDefinition.resourceType}" />
- <h:outputText value="Child Definition" rendered="#{item.alertDefinition.parentId ne 0}" />
- <h:outputText value="Alert Definition" rendered="#{not empty item.alertDefinition.resource and item.alertDefinition.parentId eq 0}" />
+ <h:outputText value="Group Alert Definition" rendered="#{not empty item.original.alertDefinition.resourceGroup}" />
+ <h:outputText value="Alert Template" rendered="#{not empty item.original.alertDefinition.resourceType}" />
+ <h:outputText value="Child Definition" rendered="#{item.original.alertDefinition.parentId ne 0}" />
+ <h:outputText value="Alert Definition" rendered="#{not empty item.original.alertDefinition.resource and item.original.alertDefinition.parentId eq 0}" />
</rich:column>
<rich:column>
@@ -137,7 +131,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{item.alertDefinition.ctime}">
+ <h:outputText value="#{item.original.alertDefinition.ctime}">
<f:converter converterId="UserDateTimeConverter" />
</h:outputText>
</rich:column>
@@ -149,23 +143,23 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputLink value="/alerts/Config.do" rendered="#{empty item.alertDefinition.resourceType and empty item.alertDefinition.resourceGroup}">
+ <h:outputLink value="/alerts/Config.do" rendered="#{empty item.original.alertDefinition.resourceType and empty item.original.alertDefinition.resourceGroup}">
<f:param name="mode" value="viewRoles" />
- <f:param name="id" value="#{item.alertDefinition.resource.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
+ <f:param name="id" value="#{item.original.alertDefinition.resource.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.resourceType}">
+ <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.resourceType}">
<f:param name="mode" value="viewRoles" />
- <f:param name="type" value="#{item.alertDefinition.resourceType.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
+ <f:param name="type" value="#{item.original.alertDefinition.resourceType.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.resourceGroup}">
+ <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.resourceGroup}">
<f:param name="mode" value="viewRoles" />
- <f:param name="groupId" value="#{item.alertDefinition.resourceGroup.id}" />
- <f:param name="ad" value="#{item.alertDefinition.id}" />
- <h:outputText value="#{item.alertDefinition.name}" />
+ <f:param name="groupId" value="#{item.original.alertDefinition.resourceGroup.id}" />
+ <f:param name="ad" value="#{item.original.alertDefinition.id}" />
+ <h:outputText value="#{item.original.alertDefinition.name}" />
</h:outputLink>
</rich:column>
@@ -173,7 +167,7 @@
<f:facet name="header">
<h:outputText styleClass="headerText" value="Alert Condition" />
</f:facet>
- <h:outputText value="#{item.conditionText}" />
+ <h:outputText value="#{item.original.conditionText}" />
</rich:column>
<rich:column>
@@ -183,7 +177,7 @@
</onc:sortableColumnHeader>
</f:facet>
- <h:outputText value="#{item.alertDefinition.enabled}"/>
+ <h:outputText value="#{item.original.alertDefinition.enabled}"/>
</rich:column>
<rich:column>
@@ -191,24 +185,24 @@
<h:outputText styleClass="headerText" value="Parent" />
</f:facet>
- <h:outputLink value="/alerts/Config.do" rendered="#{item.alertDefinition.parentId ne 0}">
+ <h:outputLink value="/alerts/Config.do" rendered="#{item.original.alertDefinition.parentId ne 0}">
<f:param name="mode" value="viewRoles"/>
- <f:param name="type" value="#{item.alertDefinition.resource.resourceType.id}"/>
- <f:param name="from" value="#{item.alertDefinition.id}"/>
- <f:param name="ad" value="#{item.alertDefinition.parentId}"/>
+ <f:param name="type" value="#{item.original.alertDefinition.resource.resourceType.id}"/>
+ <f:param name="from" value="#{item.original.alertDefinition.id}"/>
+ <f:param name="ad" value="#{item.original.alertDefinition.parentId}"/>
<h:outputText value="View Template" />
</h:outputLink>
- <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.alertDefinition.groupAlertDefinition}">
+ <h:outputLink value="/alerts/Config.do" rendered="#{not empty item.original.alertDefinition.groupAlertDefinition}">
<f:param name="mode" value="viewRoles"/>
- <f:param name="groupId" value="#{item.alertDefinition.groupAlertDefinition.resourceGroup.id}"/>
- <f:param name="from" value="#{item.alertDefinition.id}"/>
- <f:param name="ad" value="#{item.alertDefinition.groupAlertDefinition.id}"/>
+ <f:param name="groupId" value="#{item.original.alertDefinition.groupAlertDefinition.resourceGroup.id}"/>
+ <f:param name="from" value="#{item.original.alertDefinition.id}"/>
+ <f:param name="ad" value="#{item.original.alertDefinition.groupAlertDefinition.id}"/>
<h:outputText value="View Group Definition" />
</h:outputLink>
<h:outputText value="N/A"
- rendered="#{item.alertDefinition.parentId eq 0 and empty item.alertDefinition.groupAlertDefinition}" />
+ rendered="#{item.original.alertDefinition.parentId eq 0 and empty item.original.alertDefinition.groupAlertDefinition}" />
</rich:column>
<f:facet name="footer">
commit e3142c0546a77cb44124e4702d75077ef12bf52d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 2 13:11:16 2010 +0100
alert subsystem page converted to use disambiguation.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
index 5b62ecf..461b310 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/subsystem/SubsystemAlertHistoryUIBean.java
@@ -36,9 +36,11 @@ import org.rhq.core.domain.measurement.util.MeasurementConverter;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.core.util.IntExtractor;
import org.rhq.enterprise.gui.common.converter.SelectItemUtils;
import org.rhq.enterprise.gui.common.paging.PageControlView;
import org.rhq.enterprise.gui.common.paging.PagedListDataModel;
+import org.rhq.enterprise.gui.common.paging.ResourceNameDisambiguatingPagedListDataModel;
import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.subsystem.AlertSubsystemManagerLocal;
@@ -62,6 +64,13 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
private String categoryFilter;
private SelectItem[] categoryFilterItems;
+ private static final IntExtractor<AlertHistoryComposite> RESOURCE_ID_EXTRACTOR = new IntExtractor<AlertHistoryComposite>() {
+
+ public int extract(AlertHistoryComposite object) {
+ return object.getAlert().getAlertDefinition().getResource().getId();
+ }
+ };
+
public SubsystemAlertHistoryUIBean() {
datePattern = EnterpriseFacesContextUtility.getWebUser().getWebPreferences().getDateTimeDisplayPreferences()
.getDateTimeFormatTrigger();
@@ -154,13 +163,13 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
return dataModel;
}
- private class ResultsDataModel extends PagedListDataModel<AlertHistoryComposite> {
+ private class ResultsDataModel extends ResourceNameDisambiguatingPagedListDataModel<AlertHistoryComposite> {
public ResultsDataModel(PageControlView view, String beanName) {
- super(view, beanName);
+ super(view, beanName, true);
}
@Override
- public PageList<AlertHistoryComposite> fetchPage(PageControl pc) {
+ public PageList<AlertHistoryComposite> fetchDataForPage(PageControl pc) {
getDataFromRequest();
String resourceFilter = getResourceFilter();
@@ -207,6 +216,10 @@ public class SubsystemAlertHistoryUIBean extends SubsystemView {
return result;
}
+ protected IntExtractor<AlertHistoryComposite> getResourceIdExtractor() {
+ return RESOURCE_ID_EXTRACTOR;
+ }
+
private void getDataFromRequest() {
SubsystemAlertHistoryUIBean outer = SubsystemAlertHistoryUIBean.this;
outer.resourceFilter = FacesContextUtility.getOptionalRequestParameter(FORM_PREFIX + "resourceFilter");
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
index fc1c9c9..16b3667 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/subsystem/alertHistory.xhtml
@@ -90,7 +90,7 @@
</f:facet>
<onc:select name="selectedItems"
- value="#{item.alert.id}" />
+ value="#{item.original.alert.id}" />
</rich:column>
<rich:column>
@@ -101,23 +101,17 @@
</f:facet>
<h:outputLink value="#{onf:getDefaultResourceTabURL()}">
- <f:param name="id" value="#{item.alert.alertDefinition.resource.id}" />
- <h:outputText value="#{item.alert.alertDefinition.resource.name}" />
+ <f:param name="id" value="#{item.original.alert.alertDefinition.resource.id}" />
+ <h:outputText value="#{item.original.alert.alertDefinition.resource.name}" />
</h:outputLink>
</rich:column>
<rich:column>
<f:facet name="header">
- <onc:sortableColumnHeader sort="parent.name">
- <h:outputText styleClass="headerText" value="Parent" />
- </onc:sortableColumnHeader>
+ <h:outputText styleClass="headerText" value="Parent" />
</f:facet>
- <h:outputLink value="#{onf:getDefaultResourceTabURL()}"
- rendered="#{not empty item.parentResourceName}">
- <f:param name="id" value="#{item.parentResourceId}" />
- <h:outputText value="#{item.parentResourceName}" />
- </h:outputLink>
+ <onc:resourcePartialLineage parents="#{item.parents}"/>
</rich:column>
<rich:column>
@@ -129,9 +123,9 @@
<h:outputLink value="/alerts/Alerts.do">
<f:param name="mode" value="viewAlert" />
- <f:param name="id" value="#{item.alert.alertDefinition.resource.id}" />
- <f:param name="a" value="#{item.alert.id}" />
- <h:outputText value="#{item.alert.ctime}">
+ <f:param name="id" value="#{item.original.alert.alertDefinition.resource.id}" />
+ <f:param name="a" value="#{item.original.alert.id}" />
+ <h:outputText value="#{item.original.alert.ctime}">
<f:converter converterId="UserDateTimeConverter" />
</h:outputText>
</h:outputLink>
@@ -146,14 +140,14 @@
<h:outputLink value="/alerts/Config.do">
<f:param name="mode" value="viewRoles" />
- <f:param name="id" value="#{item.alert.alertDefinition.resource.id}" />
- <f:param name="ad" value="#{item.alert.alertDefinition.id}" />
+ <f:param name="id" value="#{item.original.alert.alertDefinition.resource.id}" />
+ <f:param name="ad" value="#{item.original.alert.alertDefinition.id}" />
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'LOW'}" value="/images/icons/Flag_blue_16.png"/>
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'MEDIUM'}" value="/images/icons/Flag_yellow_16.png"/>
- <h:graphicImage rendered="#{item.alert.alertDefinition.priority == 'HIGH'}" value="/images/icons/Flag_red_16.png"/>
- <h:outputText value="#{item.alert.alertDefinition.name}" />
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'LOW'}" value="/images/icons/Flag_blue_16.png"/>
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'MEDIUM'}" value="/images/icons/Flag_yellow_16.png"/>
+ <h:graphicImage rendered="#{item.original.alert.alertDefinition.priority == 'HIGH'}" value="/images/icons/Flag_red_16.png"/>
+ <h:outputText value="#{item.original.alert.alertDefinition.name}" />
</h:outputLink>
</rich:column>
@@ -161,21 +155,21 @@
<f:facet name="header">
<h:outputText styleClass="headerText" value="Alert Condition" />
</f:facet>
- <h:outputText value="#{item.conditionText}" />
+ <h:outputText value="#{item.original.conditionText}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Actual Value" />
</f:facet>
- <h:outputText value="#{item.conditionValue}" />
+ <h:outputText value="#{item.original.conditionValue}" />
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Recovery Info" />
</f:facet>
- <h:outputText value="#{item.recoveryInfo}" />
+ <h:outputText value="#{item.original.recoveryInfo}" />
</rich:column>
<f:facet name="footer">
commit 375783056755b78f3e3e4defeeb96673e1b7b394
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Feb 2 13:09:12 2010 +0100
Short-circuit the disambiguation if there are no results to disambiguate.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 189933a..54ad752 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2136,8 +2136,11 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return (findChildResources(subject, parentResource, pageControl));
}
- public <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwaysIncludeParent,
- IntExtractor<? super T> extractor) {
+ public <T> ResourceNamesDisambiguationResult<T> disambiguate(List<T> results, boolean alwaysIncludeParent, IntExtractor<? super T> extractor) {
+ if (results.isEmpty()) {
+ return new ResourceNamesDisambiguationResult<T>(new ArrayList<DisambiguationReport<T>>(), false, false, false);
+ }
+
String query = Resource.NATIVE_QUERY_FIND_DISAMBIGUATION_LEVEL;
query = JDBCUtil.transformQueryForMultipleInParameters(query, "@@RESOURCE_IDS@@", results.size());
commit 708784aa4441db6137fbdac5899ff167eb3b1829
Merge: bf195d7... 054907f...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 17:39:21 2010 +0100
Merge branch 'master' into alertPlugin
commit b9d4cf85a94577bfc7dc04bd7ff7ceffdba95d96
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 11:33:07 2010 -0500
Updating plugin code to properly handle omitted plugin configuration properties
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
index 27ba07a..7bf2dee 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
@@ -65,14 +65,14 @@ class ConfigurationServer {
def pauseForRawUpdateIfDelaySet() {
def delay = resourceContext.pluginConfiguration.getSimple("rawUpdateDelay")
- if (delay) {
+ if (delay.longValue) {
Thread.sleep(delay.longValue)
}
}
def pauseForStructuredUpdateIfDelaySet() {
def delay = resourceContext.pluginConfiguration.getSimple("structuredUpdateDelay")
- if (delay) {
+ if (delay.longValue) {
Thread.sleep(delay.longValue)
}
}
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 5743a4b..8a881e6 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
@@ -80,7 +80,7 @@ class RawServer extends ConfigurationServer implements ResourceComponent, Resour
void persistRawConfiguration(RawConfiguration rawConfiguration) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failRawUpdate")
- if (failValidation.booleanValue) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new RuntimeException("Update failed for ${rawConfiguration.path}");
}
@@ -93,7 +93,7 @@ class RawServer extends ConfigurationServer implements ResourceComponent, Resour
void validateRawConfiguration(RawConfiguration rawConfiguration) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failRawValidation")
- if (failValidation.getBooleanValue()) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new IllegalArgumentException("Validation failed for ${rawConfiguration.path}");
}
}
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index c1d6aab..39721d0 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -155,7 +155,7 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
void validateRawConfiguration(RawConfiguration rawConfig) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failRawValidation")
- if (failValidation.booleanValue) {
+ if (failValidation != null && failValidation.booleanValue) {
def fileNames = resourceContext.pluginConfiguration.getSimple("filesToFailValidation").stringValue.split()
def match = fileNames.find { rawConfig.path.endsWith(it) }
@@ -167,14 +167,14 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
void validateStructuredConfiguration(Configuration config) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
- if (failValidation.getBooleanValue()) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new RuntimeException("Validation failed for $config");
}
}
void persistStructuredConfiguration(Configuration config) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredUpdate")
- if (failValidation.getBooleanValue()) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new RuntimeException("Update failed for $configuration");
}
@@ -183,7 +183,7 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
void persistRawConfiguration(RawConfiguration rawConfiguration) {
def failUpdate = resourceContext.pluginConfiguration.getSimple("failRawUpdate")
- if (failUpdate.getBooleanValue()) {
+ if (failUpdate != null && failUpdate.booleanValue) {
def fileNames = resourceContext.pluginConfiguration.getSimple("filesToFailUpdate").stringValue.split()
def match = fileNames.find { rawConfiguration.path.endsWith(it) }
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index 4095a98..2e9b2c5 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -95,7 +95,7 @@ class StructuredServer extends ConfigurationServer implements ResourceComponent,
void persistStructuredConfiguration(Configuration configuration) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredUpdate")
- if (failValidation.booleanValue) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new RuntimeException("Validation failed for $configuration");
}
@@ -142,7 +142,7 @@ class StructuredServer extends ConfigurationServer implements ResourceComponent,
void validateStructuredConfiguration(Configuration configuration) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
- if (failValidation.booleanValue) {
+ if (failValidation != null && failValidation.booleanValue) {
throw new RuntimeException("Validation failed for $configuration");
}
}
commit bf195d7e0906dcc78070217c088a0565c7ebc578
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 17:27:13 2010 +0100
Bring back in the dependency on seam
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml
index a834767..019db2f 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -30,6 +30,19 @@
<dependencies>
<dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+
+ <dependency>
<groupId>jboss.jboss-embeddable-ejb3</groupId>
<artifactId>jboss-ejb3-all</artifactId>
<version>1.0.0.Alpha9</version>
commit cded991b3a57412d3d37d385d9affc01ce61a232
Merge: 3c58c9c... 054907f...
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Feb 9 10:54:59 2010 -0500
Merge branch 'master' into linux-config
commit 08427aac1e81841dfbb9b27a65e1ec799f4cb206
Merge: b8f5a63... 31af0f2...
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 10:20:38 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 5109304fd2ce9c96867ab4850075a5e3ee8247ee
Merge: 13a63d7... 524d628...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 16:16:59 2010 +0100
Merge branch 'master' into alertPlugin
Conflicts:
modules/enterprise/server/plugins/alert-roles/pom.xml
modules/enterprise/server/plugins/alert-scriptlang/pom.xml
modules/enterprise/server/plugins/alert-subject/pom.xml
modules/enterprise/server/plugins/pom.xml
diff --cc modules/enterprise/gui/portal-war/pom.xml
index 19a345f,257c704..5688544
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@@ -394,33 -381,9 +394,23 @@@
<finalName>rhq-portal</finalName>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1-alpha-1</version>
<configuration>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- <manifestEntries>
- <Build-Number>${buildNumber}</Build-Number>
- </manifestEntries>
- </archive>
<webResources>
<resource>
<filtering>false</filtering>
diff --cc modules/enterprise/server/plugins/alert-roles/pom.xml
index 8f22253,f90008b..2287067
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@@ -26,20 -26,13 +26,6 @@@
<dependencies>
<dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope> <!-- by ear -->
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-enterprise-server</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.3.1</version>
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <dependency>
<groupId>org.jboss.seam</groupId>
<artifactId>jboss-seam</artifactId>
<version>${seam.version}</version>
diff --cc modules/enterprise/server/plugins/pom.xml
index 53a00e2,d799788..3d40978
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@@ -32,27 -32,50 +32,54 @@@
<version>${project.version}</version>
<type>ejb</type>
</dependency>
+
+ <!-- nearly all server-side plugins access some of the domain classes. therefore, pull up this dependency -->
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>ejb</type>
+ </dependency>
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be available when compiling dependent classes.
+ It is fixed in JDK 6
+ -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ <scope>provided</scope>
+ <!-- needed for referenced domain entities that use Hibernate annotations -->
+ </dependency>
</dependencies>
- <modules>
- <module>disk</module>
- <module>yum</module>
- <module>url</module>
- <module>rhnhosted</module>
- <module>jboss-software</module>
- <module>perspectives/core</module>
- <module>alert-email</module>
- <module>alert-irc</module>
- <module>alert-mobicents</module>
- <module>alert-microblog</module>
- <module>alert-roles</module>
- <module>alert-snmp</module>
- <module>alert-subject</module>
- <module>cobbler</module>
- <module>validate-all-serverplugins</module>
- </modules>
+ <modules>
+ <module>disk</module>
+ <module>yum</module>
+ <module>url</module>
+ <module>rhnhosted</module>
+ <module>jboss-software</module>
+ <module>perspectives/core</module>
+ <module>alert-email</module>
+ <module>alert-irc</module>
+ <module>alert-mobicents</module>
+ <module>alert-microblog</module>
+ <module>alert-roles</module>
+ <module>alert-scriptlang</module>
+ <!-- Seeing strange issues with corrupt jar dependencies...
+ <module>alert-sms</module>
+ -->
+ <module>alert-snmp</module>
+ <module>alert-subject</module>
+ <module>cobbler</module>
+ <module>validate-all-serverplugins</module>
+ </modules>
</project>
commit b8f5a631a2a2ef83ffa5688b78e5b2dcc443eb16
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 9 10:14:39 2010 -0500
Updating StructuredServer and RawServer to support delays for update operations
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
index 97a9188..27ba07a 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
@@ -63,4 +63,18 @@ class ConfigurationServer {
file << rawConfiguration.contents
}
+ def pauseForRawUpdateIfDelaySet() {
+ def delay = resourceContext.pluginConfiguration.getSimple("rawUpdateDelay")
+ if (delay) {
+ Thread.sleep(delay.longValue)
+ }
+ }
+
+ def pauseForStructuredUpdateIfDelaySet() {
+ def delay = resourceContext.pluginConfiguration.getSimple("structuredUpdateDelay")
+ if (delay) {
+ Thread.sleep(delay.longValue)
+ }
+ }
+
}
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 304ef24..5743a4b 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
@@ -79,11 +79,12 @@ class RawServer extends ConfigurationServer implements ResourceComponent, Resour
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
- def failValidation = resourceContext.pluginConfiguration.getSimple("failUpdate")
- if (failValidation.getBooleanValue()) {
+ def failValidation = resourceContext.pluginConfiguration.getSimple("failRawUpdate")
+ if (failValidation.booleanValue) {
throw new RuntimeException("Update failed for ${rawConfiguration.path}");
}
+ pauseForRawUpdateIfDelaySet()
backupAndSave(rawConfiguration)
}
@@ -91,7 +92,7 @@ class RawServer extends ConfigurationServer implements ResourceComponent, Resour
}
void validateRawConfiguration(RawConfiguration rawConfiguration) {
- def failValidation = resourceContext.pluginConfiguration.getSimple("failValidation")
+ def failValidation = resourceContext.pluginConfiguration.getSimple("failRawValidation")
if (failValidation.getBooleanValue()) {
throw new IllegalArgumentException("Validation failed for ${rawConfiguration.path}");
}
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index da67206..c1d6aab 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -155,7 +155,7 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
void validateRawConfiguration(RawConfiguration rawConfig) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failRawValidation")
- if (failValidation.getBooleanValue()) {
+ if (failValidation.booleanValue) {
def fileNames = resourceContext.pluginConfiguration.getSimple("filesToFailValidation").stringValue.split()
def match = fileNames.find { rawConfig.path.endsWith(it) }
@@ -178,10 +178,7 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
throw new RuntimeException("Update failed for $configuration");
}
- def delay = resourceContext.pluginConfiguration.getSimple("structuredUpdateDelay")
- if (delay) {
- Thread.sleep(delay.longValue)
- }
+ pauseForStructuredUpdateIfDelaySet()
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
@@ -195,11 +192,7 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
}
}
- def delay = resourceContext.pluginConfiguration.getSimple("rawUpdateDelay")
- if (delay) {
- Thread.sleep(delay.longValue)
- }
-
+ pauseForRawUpdateIfDelaySet()
backupAndSave(rawConfiguration)
}
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index 5eda9c9..4095a98 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -94,11 +94,13 @@ class StructuredServer extends ConfigurationServer implements ResourceComponent,
}
void persistStructuredConfiguration(Configuration configuration) {
- def failValidation = resourceContext.pluginConfiguration.getSimple("failUpdate")
- if (failValidation.getBooleanValue()) {
+ def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredUpdate")
+ if (failValidation.booleanValue) {
throw new RuntimeException("Validation failed for $configuration");
}
+ pauseForStructuredUpdateIfDelaySet()
+
ant.copy(file: structuredConfigFile.absolutePath, tofile: "${structuredConfigFile.absolutePath}.orig")
ant.delete(file: structuredConfigFile)
@@ -139,8 +141,8 @@ class StructuredServer extends ConfigurationServer implements ResourceComponent,
}
void validateStructuredConfiguration(Configuration configuration) {
- def failValidation = resourceContext.pluginConfiguration.getSimple("failValidation")
- if (failValidation.getBooleanValue()) {
+ def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
+ if (failValidation.booleanValue) {
throw new RuntimeException("Validation failed for $configuration");
}
}
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index 686e3e5..6b7d884 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -72,8 +72,21 @@
description="A fake server component that supports raw configuration">
<plugin-configuration>
- <c:simple-property name="failRawValidation" type="boolean" default="false"/>
- <c:simple-property name="failRawUpdate" type="boolean" default="false"/>
+ <c:group name="Raw Validation">
+ <c:simple-property name="failRawValidation" type="boolean" default="false"/>
+ <c:simple-property name="failRawUpdate" type="boolean" default="false"/>
+ </c:group>
+
+ <c:group name="Operation Delays">
+ <c:simple-property name="rawUpdateDelay"
+ type="integer"
+ required="false"
+ description="A delay specified in milliseconds to simulate a long running operation. This
+ delay will affect the raw update method, persistRawConfiguration. Note that
+ persistRawConfiguration is called once for each raw config file; so, if you
+ specify a delay of 5000 (i.e., 5 seconds) and there are 5 raw config files,
+ then this will result in a delay of 25 seconds."/>
+ </c:group>
</plugin-configuration>
<resource-configuration configurationFormat="raw"/>
@@ -85,8 +98,18 @@
description="A fake server component that supports structured configuration">
<plugin-configuration>
- <c:simple-property name="failStructuredValidation" type="boolean" default="false"/>
- <c:simple-property name="failStructuredUpdate" type="boolean" default="false"/>
+ <c:group name="Structured Validation">
+ <c:simple-property name="failStructuredValidation" type="boolean" default="false"/>
+ <c:simple-property name="failStructuredUpdate" type="boolean" default="false"/>
+ </c:group>
+
+ <c:group name="Operation Delays">
+ <c:simple-property name="structuredUpdateDelay"
+ type="integer"
+ required="false"
+ description="A delay specified in milliseconds to simulate a long running operation. This
+ delay will affect the structured update method, persistStructuredConfiguration."/>
+ </c:group>
</plugin-configuration>
<resource-configuration configurationFormat="structured">
commit 13a63d7e1c1a84b354dcbd2f6b66cdd573b74f54
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 15:51:37 2010 +0100
If email sending fails, we record the failing ones and set the status accordingly
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index 7614d7d..d8ce079 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -97,7 +97,7 @@
<field ref="ALERT_ID"/>
</index>
<column name="SENDER" required="false" size="200" type="VARCHAR2"/>
- <column name="RESULT" required="false" size="20" type="VARCHAR2"/>
+ <column name="RESULT_STATE" required="false" size="20" type="VARCHAR2"/>
<column name="MESSAGE" required="false" size="255" type="VARCHAR2"/>
<column name="ALL_EMAILS" required="false" size="4096" type="VARCHAR2"/>
<column name="EMAILS_FAILED" required="false" size="4096" type="VARCHAR2"/>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 0242de1..febfa44 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3025,7 +3025,7 @@
<schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="emails"/>
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="SENDER" columnType="VARCHAR2" precision="200" />
- <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="RESULT" columnType="VARCHAR2" precision="20" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="RESULT_STATE" columnType="VARCHAR2" precision="20" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="255" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="ALL_EMAILS" columnType="VARCHAR2" precision="4096" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_FAILED" columnType="VARCHAR2" precision="4096" />
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 373f380..d7ee950 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -24,6 +24,8 @@ package org.rhq.core.domain.alert.notification;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -38,6 +40,7 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
@@ -89,9 +92,9 @@ public class AlertNotificationLog implements Serializable {
private String sender;
- @Column(name ="RESULT")
+ @Column(name ="RESULT_STATE")
@Enumerated(EnumType.STRING)
- private ResultState result;
+ private ResultState resultState;
private String message;
@@ -101,26 +104,29 @@ public class AlertNotificationLog implements Serializable {
@Column(name="EMAILS_FAILED")
private String badEmails;
+ @Transient
+ transient List<String> tranisentEmails = new ArrayList<String>();
+
protected AlertNotificationLog() {
} // JPA
public AlertNotificationLog(Alert alert, String sender, SenderResult senderResult) {
this.alert = alert;
this.sender = sender;
- this.result = senderResult.getState();
+ this.resultState = senderResult.getState();
this.message = senderResult.getMessage();
}
public AlertNotificationLog(Alert alert, String sender) {
this.alert = alert;
this.sender = sender;
- this.result = ResultState.FAILURE; // Default if nothing specified
+ this.resultState = ResultState.FAILURE; // Default if nothing specified
}
public AlertNotificationLog(Alert alert, String senderName, ResultState state, String message) {
this.alert = alert;
this.sender = sender;
- this.result = state;
+ this.resultState = state;
this.message = message;
}
@@ -142,8 +148,8 @@ public class AlertNotificationLog implements Serializable {
return sender;
}
- public ResultState getResult() {
- return result;
+ public ResultState getResultState() {
+ return resultState;
}
public String getMessage() {
@@ -158,8 +164,8 @@ public class AlertNotificationLog implements Serializable {
return badEmails;
}
- public void setResult(ResultState result) {
- this.result = result;
+ public void setResultState(ResultState resultState) {
+ this.resultState = resultState;
}
public void setMessage(String message) {
@@ -173,4 +179,12 @@ public class AlertNotificationLog implements Serializable {
public void setBadEmails(String badEmails) {
this.badEmails = badEmails;
}
+
+ public List<String> getTranisentEmails() {
+ return tranisentEmails;
+ }
+
+ public void setTranisentEmails(List<String> tranisentEmails) {
+ this.tranisentEmails = tranisentEmails;
+ }
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java
index f0f5ad9..0c8d1bc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java
@@ -29,5 +29,7 @@ public enum ResultState {
/** Deferred_email: this sender itself was successful, but l8er email sending may fail */
DEFERRED_EMAIL,
/** Failure: sending of the notification failed */
- FAILURE
+ FAILURE,
+ /** Sending one ore more emails from the plugin failed */
+ FAILED_EMAIL
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 11e5569..fcc5fb8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -22,7 +22,6 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
@@ -666,7 +665,6 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
log.debug("Sending alert notifications for " + alert.toSimpleString() + "...");
List<AlertNotification> alertNotifications = alert.getAlertDefinition().getAlertNotifications();
Set<String> emailAddresses = new LinkedHashSet<String>();
- List<AlertNotificationLog> logs = new ArrayList<AlertNotificationLog>();
for (AlertNotification alertNotification : alertNotifications) {
@@ -677,22 +675,31 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
continue;
}
- AlertNotificationLog alNoLo ;
+ AlertNotificationLog alNoLo;
AlertSender sender = getAlertSender(alertNotification);
if (sender != null) {
try {
SenderResult result = sender.send(alert);
+
if (result == null) {
log.warn("- !! -- sender [" + senderName +
"] did not return a SenderResult. Please fix this -- !! - ");
+ alNoLo = new AlertNotificationLog(alert,senderName);
+ alNoLo.setMessage("Sender did not return a SenderResult, assuming failure");
+
} else if (result.getState() == ResultState.DEFERRED_EMAIL) {
- if (result.getEmails() != null && !result.getEmails().isEmpty())
+
+ alNoLo = new AlertNotificationLog(alert, senderName, result);
+ if (result.getEmails() != null && !result.getEmails().isEmpty()) {
emailAddresses.addAll(result.getEmails());
+ alNoLo.setTranisentEmails(result.getEmails());
+ alNoLo.setAllEmails(result.getEmails().toString());
+ }
+ } else {
+ alNoLo = new AlertNotificationLog(alert, senderName, result);
}
- // TODO log result - especially handle the deferred_email case
log.info(result);
- alNoLo = new AlertNotificationLog(alert, senderName, result);
}
catch (Throwable t) {
log.error("Sender failed: " + t.getMessage());
@@ -710,18 +717,28 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
entityManager.persist(alNoLo);
alert.addAlertNotificatinLog(alNoLo);
- logs.add(alNoLo);
}
// send them off
Collection<String> badAddresses = sendAlertNotificationEmails(alert, emailAddresses);
// TODO we may do the same for SMS in the future.
- // TODO log those bad addresses to the gui and their individual senders (if possible)
+ // log those bad addresses to the gui and their individual senders (if possible)
if (!badAddresses.isEmpty()) {
- for (int i = 0; i < alertNotifications.size(); i++) {
- AlertNotification notification = alertNotifications.get(i);
- // fill in badAdd if needed
+ for (AlertNotificationLog anl : alert.getAlertNotificationLog()) {
+ if (!(anl.getResultState() == ResultState.DEFERRED_EMAIL))
+ continue;
+
+ StringBuilder b = new StringBuilder();
+ for (String badOne : badAddresses) {
+ if (anl.getTranisentEmails().contains(badOne)) {
+ anl.setResultState(ResultState.FAILED_EMAIL);
+ b.append(badOne);
+ b.append(", ");
+ }
+ }
+ if (anl.getResultState()==ResultState.FAILED_EMAIL)
+ anl.setBadEmails(b.toString());
}
}
commit 31af0f2036f5d0759d1b0816379c19d36100fc35
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Feb 8 17:21:34 2010 -0500
Edit of contents resets error message.\n Attempt to cycle through all Raw Configs even on unexpected exceptions. \n Marshall Exceptions from Agent to server with WrappedRemotingException.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index d0a3d8c..7356cd0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -126,6 +126,7 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
*/
public void setContents(String contents) {
this.contents = contents;
+ this.errorMessage = null;
updateSha256();
}
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 37a9252..3e41847 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
@@ -22,19 +22,26 @@
*/
package org.rhq.core.pc.configuration;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
-import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ContainerService;
import org.rhq.core.pc.PluginContainer;
@@ -50,17 +57,6 @@ import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.template.TemplateEngine;
import org.rhq.core.util.exception.WrappedRemotingException;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
/**
* Manages configuration of all resources across all plugins.
*
@@ -338,29 +334,33 @@ public class ConfigurationManager extends AgentService implements ContainerServi
public void validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
-
+
boolean thereAreErrors = false;
-
+
boolean daemonOnly = true;
boolean onlyIfStarted = true;
ResourceConfigurationFacet facet = componentService.getComponent(resourceId, ResourceConfigurationFacet.class,
FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- try {
- //TODO Extend the API so that structured can return a collection
- if(isStructured){
- facet.validateStructuredConfiguration(configuration);
- }else{
- for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- thereAreErrors = true;
- rawConfiguration.errorMessage = e.getMessage();
- }
+ if (isStructured) {
+ try {
+ facet.validateStructuredConfiguration(configuration);
+ } catch (IllegalArgumentException e) {
+ thereAreErrors = true;
+ } catch (Throwable t) {
+ throw new PluginContainerException(t.getMessage(), new WrappedRemotingException(t));
+ }
+ } else {
+ for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ thereAreErrors = true;
+ rawConfiguration.errorMessage = e.getMessage();
+ } catch (Throwable t) {
+ thereAreErrors = true;
+ rawConfiguration.errorMessage = t.getMessage();
}
}
- } catch (Throwable t) {
- throw new PluginContainerException(t.getMessage());
}
if (thereAreErrors) {
throw new PluginContainerException("One or more files failed validation");
commit b25e363984097fdb002a6a29927663a173eebc09
Author: Adam Young <ayoung(a)redhat.com>
Date: Fri Feb 5 14:59:51 2010 -0500
Isolated Exceptions thrown from Validation to prevent class not found errors on the server. Added correct result handling in the ResourceCOnfiguraitonEditor for the fact that update now always returns an object, never a null.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index 2e3291c..d0a3d8c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -38,6 +38,8 @@ import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import javax.persistence.Transient;
+
import java.io.Serializable;
/**
@@ -89,7 +91,8 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
* set when validation indicates that there is a problem
* with the file structure.
*/
- private String errorMessage;
+ @Transient
+ public String errorMessage;
/** @return The database identifier or primary key */
public int getId() {
@@ -160,15 +163,6 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
this.configuration = configuration;
}
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /** @param validation error message */
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
@PrePersist
void onPersist() {
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 551b687..37a9252 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
@@ -355,12 +355,12 @@ public class ConfigurationManager extends AgentService implements ContainerServi
facet.validateRawConfiguration(rawConfiguration);
} catch (IllegalArgumentException e) {
thereAreErrors = true;
- rawConfiguration.setErrorMessage(e.getMessage());
+ rawConfiguration.errorMessage = e.getMessage();
}
}
}
} catch (Throwable t) {
- throw new PluginContainerException(t);
+ throw new PluginContainerException(t.getMessage());
}
if (thereAreErrors) {
throw new PluginContainerException("One or more files failed validation");
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 1268d58..b5d9c14 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -227,7 +227,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
if (null != mergedConfiguration) {
for (RawConfiguration raw : mergedConfiguration.getRawConfigurations()) {
- String message = raw.getErrorMessage();
+ String message = raw.errorMessage;
if (message != null) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index f120da2..af920cb 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -38,6 +38,7 @@ import org.rhq.core.gui.util.FacesContextUtility;
import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+
import org.richfaces.model.UploadItem;
import javax.faces.application.FacesMessage;
@@ -185,13 +186,19 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
case FAILURE:
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+ String message = raw.errorMessage;
+ if (message != null) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
+ }
+ }
return "failure";
- }
- }
- else {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
- + "no update request has been sent to the Agent.");
- return "success";
+
+ case NOCHANGE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
+ + "no update request has been sent to the Agent.");
+ return "success";
+ }
}
return null;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index d3e1a32..aac3b24 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -989,14 +989,14 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (isStructuredAndRawSupported(resourceId)) {
configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
}
-
- if (isRawSupported(resourceId)) {
- try {
- validateResourceConfiguration(subject, resourceId, newConfiguration, false);
- } catch (PluginContainerException e) {
- Resource resource = resourceManager.getResourceById(subject, resourceId);
- return new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
- }
+ try {
+ validateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
+ } catch (PluginContainerException e) {
+ Resource resource = resourceManager.getResourceById(subject, resourceId);
+ ResourceConfigurationUpdate resourceConfigurationUpdate = new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
+ resourceConfigurationUpdate.setErrorMessage(e.getMessage());
+ resourceConfigurationUpdate.setStatus(ConfigurationUpdateStatus.FAILURE);
+ return resourceConfigurationUpdate;
}
ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(
commit 774755298e156c37045ab92473c6719f6a231908
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Feb 4 19:29:40 2010 -0500
Instead of returning a null, the update method always returns a ResourceConfigurationUpdate object.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
index 550d4a2..1b89ec7 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
@@ -40,15 +40,6 @@ import java.util.List;
public class PluginContainerException extends Exception {
private static final long serialVersionUID = 1L;
- private final List<String> messages;
-
- public PluginContainerException(List<String> messages) {
- super();
- List<String> msgs = new ArrayList<String>();
- Collections.copy(msgs, messages);
- this.messages = msgs;
- }
-
/**
* Because this exception is part of the plugin container's client API and thus is to be available on remote clients
* as well, make sure the <code>cause</code> throwable you pass to this constructor is also available to remote
@@ -59,7 +50,6 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(Throwable cause) {
super(cause);
- messages = Collections.emptyList();
}
/**
@@ -72,14 +62,12 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(String message, Throwable cause) {
super(message, cause);
- messages = Collections.emptyList();
- }
+ }
/**
* @see Throwable#Throwable()
*/
public PluginContainerException() {
- messages = Collections.emptyList();
}
/**
@@ -87,10 +75,6 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(String message) {
super(message);
- messages = Collections.emptyList();
}
- public Iterator<String> messageIterator() {
- return messages.iterator();
- }
}
\ No newline at end of file
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
index f8f01bc..ce02414 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
@@ -30,7 +30,7 @@ package org.rhq.core.domain.configuration;
* @author John Mazzitelli
*/
public enum ConfigurationUpdateStatus {
- INPROGRESS("In Progress"), SUCCESS("Success"), FAILURE("Failure");
+ INPROGRESS("In Progress"), SUCCESS("Success"), FAILURE("Failure"),NOCHANGE("No Change");
private String displayName;
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index e4e3d7e..2e3291c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -84,6 +84,13 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
@JoinColumn(name = "CONFIG_ID", nullable = false)
private Configuration configuration;
+ /**
+ * THis value is not persisted to the database, but is
+ * set when validation indicates that there is a problem
+ * with the file structure.
+ */
+ private String errorMessage;
+
/** @return The database identifier or primary key */
public int getId() {
return id;
@@ -153,6 +160,16 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
this.configuration = configuration;
}
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /** @param validation error message */
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+
@PrePersist
void onPersist() {
mtime = System.currentTimeMillis();
@@ -258,5 +275,6 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
return copy;
}
+
}
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 2b16960..551b687 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
@@ -338,34 +338,32 @@ public class ConfigurationManager extends AgentService implements ContainerServi
public void validate(Configuration configuration, int resourceId, boolean isStructured)
throws PluginContainerException {
+
+ boolean thereAreErrors = false;
+
boolean daemonOnly = true;
boolean onlyIfStarted = true;
ResourceConfigurationFacet facet = componentService.getComponent(resourceId, ResourceConfigurationFacet.class,
FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- ArrayList<String> errors = new ArrayList<String>();
try {
//TODO Extend the API so that structured can return a collection
if(isStructured){
facet.validateStructuredConfiguration(configuration);
}else{
- validateRaw(configuration, facet, errors);
+ for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ thereAreErrors = true;
+ rawConfiguration.setErrorMessage(e.getMessage());
+ }
+ }
}
} catch (Throwable t) {
- errors.clear();
- errors.add("configuation validation failed with" + t.getMessage() + ".");
+ throw new PluginContainerException(t);
}
- if (!errors.isEmpty()) {
- throw new PluginContainerException(new ConfigurationValidationException(errors));
- }
- }
-
- private void validateRaw(Configuration configuration, ResourceConfigurationFacet facet, ArrayList<String> errors) {
- for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- errors.add(rawConfiguration.getPath() + " :" + e.getMessage());
- }
+ if (thereAreErrors) {
+ throw new PluginContainerException("One or more files failed validation");
}
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 0679d0f..1268d58 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -205,45 +205,45 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
}
public String updateConfiguration(boolean fromStructured) {
-
+ Configuration mergedConfiguration = null;
ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition());
int resourceId = EnterpriseFacesContextUtility.getResource().getId();
-
- try {
- AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
- .updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(), resourceId,
- getMergedConfiguration(), fromStructured);
- if (updateRequest != null) {
- switch (updateRequest.getStatus()) {
- case SUCCESS:
- case INPROGRESS:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
- + updateRequest.getId() + " has been sent to the Agent.");
- clearConfiguration();
- return SUCCESS_OUTCOME;
- case FAILURE:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
- + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
- return FAILURE_OUTCOME;
-
+
+ mergedConfiguration = getMergedConfiguration();
+ AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
+ .updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(), resourceId,
+ mergedConfiguration, fromStructured);
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+
+ if (null != mergedConfiguration) {
+ for (RawConfiguration raw : mergedConfiguration.getRawConfigurations()) {
+ String message = raw.getErrorMessage();
+ if (message != null) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.getPath(), message);
+ }
+ }
}
- } else {
+
+ return FAILURE_OUTCOME;
+ case NOCHANGE:
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
"No changes were made to the configuration, so " + "no update request has been sent to the Agent.");
clearConfiguration();
return SUCCESS_OUTCOME;
- }
- return null;
- } catch (EJBException e) {
- if (e.getCause() instanceof ConfigurationValidationException) {
- ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
- for (Iterator<String> i = exception.messageIterator(); i.hasNext();) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "", i.next());
- }
}
- return FAILURE_OUTCOME;
}
+ return FAILURE_OUTCOME;
}
public String finishAddMap() {
@@ -322,7 +322,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
--numberOfModifiedFiles;
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
-// rawUIBean.setModified(false);
+ // rawUIBean.setModified(false);
getModified().remove(editedRaw.getPath());
} else {
++numberOfModifiedFiles;
@@ -335,8 +335,8 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
if (bean != null) {
-// bean.setModified(false);
-// bean.setIcon("/images/blank.png");
+ // bean.setModified(false);
+ // bean.setIcon("/images/blank.png");
}
}
@@ -503,7 +503,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
private void markCurrentRawConfigUIBeanModified() {
RawConfigUIBean bean = findRawConfigUIBeanByPath(current.getPath());
if (bean != null) {
-// bean.setModified(true);
+ // bean.setModified(true);
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 3d37413..d3e1a32 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -982,7 +982,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
- ConfigurationUpdateStillInProgressException, ConfigurationValidationException {
+ ConfigurationUpdateStillInProgressException {
Configuration configToUpdate = newConfiguration;
@@ -994,14 +994,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
try {
validateResourceConfiguration(subject, resourceId, newConfiguration, false);
} catch (PluginContainerException e) {
- if (e.getCause() instanceof ConfigurationValidationException) {
- ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
- throw exception;
- } else {
- List<String> messages = new ArrayList<String>();
- messages.add(e.getMessage());
- throw new ConfigurationValidationException(messages);
- }
+ Resource resource = resourceManager.getResourceById(subject, resourceId);
+ return new ResourceConfigurationUpdate(resource, newConfiguration, subject.getName());
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index fd59ca9..755427c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.configuration;
import org.jetbrains.annotations.Nullable;
import org.quartz.SchedulerException;
+import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.auth.Subject;
@@ -98,9 +99,9 @@ public interface ConfigurationManagerLocal {
*/
Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst)
throws Exception;
-
+
Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst,
- boolean fromStructured) throws Exception;
+ boolean fromStructured) throws Exception;
PageList<PluginConfigurationUpdate> findPluginConfigurationUpdates(Subject subject, int resourceId, Long beginDate,
Long endDate, PageControl pc);
@@ -474,8 +475,8 @@ public interface ConfigurationManagerLocal {
Configuration newConfiguration) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException;
ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
- Configuration newConfiguration, boolean fromStructured)
- throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException,ConfigurationValidationException;
+ Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
+ ConfigurationUpdateStillInProgressException;
Configuration getResourceConfiguration(Subject subject, int resourceId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
index 40b401e..4d834fd 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
@@ -29,6 +29,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.jetbrains.annotations.Nullable;
+import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
@@ -187,7 +188,7 @@ public interface ConfigurationManagerRemote {
@WebParam
@XmlJavaTypeAdapter(ConfigurationAdapter.class) Configuration newConfiguration,
@WebParam boolean fromStructured)
- throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException;
+ throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException, PluginContainerException;
/**
* Get the currently live resource configuration for the {@link Resource} with the given id. This actually asks for
commit b9faaab438123d51b15a88615b306102812ec81b
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Feb 4 10:34:35 2010 -0500
Fixed typo, removed temp file from test.
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 c9eb012..2b16960 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
@@ -344,7 +344,7 @@ public class ConfigurationManager extends AgentService implements ContainerServi
FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
ArrayList<String> errors = new ArrayList<String>();
try {
- //TODO Extend the API so that structureed can return a collection
+ //TODO Extend the API so that structured can return a collection
if(isStructured){
facet.validateStructuredConfiguration(configuration);
}else{
diff --git a/temp-testng-customsuite.xml b/temp-testng-customsuite.xml
deleted file mode 100644
index bda4467..0000000
--- a/temp-testng-customsuite.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="rhq" parallel="">
- <test verbose="2" name="org.rhq.core.pc.configuration.ConfigurationManagerTest" annotations="JDK">
- <classes>
- <class name="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- </classes>
- </test>
-</suite>
commit 97ec59eda532ecf04f39913f7b6de287bf6a450a
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Feb 4 10:15:33 2010 -0500
Added test for structured validation.
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 85f13ca..c9eb012 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
@@ -344,12 +344,11 @@ public class ConfigurationManager extends AgentService implements ContainerServi
FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
ArrayList<String> errors = new ArrayList<String>();
try {
- for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- errors.add(rawConfiguration.getPath() + " :" + e.getMessage());
- }
+ //TODO Extend the API so that structureed can return a collection
+ if(isStructured){
+ facet.validateStructuredConfiguration(configuration);
+ }else{
+ validateRaw(configuration, facet, errors);
}
} catch (Throwable t) {
errors.clear();
@@ -359,4 +358,14 @@ public class ConfigurationManager extends AgentService implements ContainerServi
throw new PluginContainerException(new ConfigurationValidationException(errors));
}
}
+
+ private void validateRaw(Configuration configuration, ResourceConfigurationFacet facet, ArrayList<String> errors) {
+ for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ errors.add(rawConfiguration.getPath() + " :" + e.getMessage());
+ }
+ }
+ }
}
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 5c28e01..6c74811 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
@@ -329,6 +329,40 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
}
}
+
+ @Test
+ public void catchExceptionThrownByFailedValidationOfStructuredConfigs() throws Exception {
+
+ final Configuration configuration = new Configuration();
+ //final RawConfiguration rawConfiguration = createRawConfiguration("/tmp/foo.txt");
+ //configuration.addRawConfiguration(rawConfiguration);
+ final ResourceConfigurationFacet facet = context.mock(ResourceConfigurationFacet.class);
+
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(resourceType));
+
+ atLeast(1).of(componentService).getComponent(resourceId, ResourceConfigurationFacet.class,
+ FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT, daemonThread, onlyIfStarted);
+ will(returnValue(facet));
+
+ //allowing(facet).validateRawConfiguration(rawConfiguration);
+ allowing(facet).validateStructuredConfiguration(configuration);
+ will(throwException(new IllegalArgumentException("message")));
+ }
+ });
+ try {
+ configurationMgr.validate(configuration, resourceId, true);
+ assertTrue(false);
+ } catch (PluginContainerException exception) {
+ //SUCCESS
+ }
+ }
+
+
+
+
@Test
public void mergingRawsIntoStructuredShouldIgnoreNull() throws Exception {
Configuration config = new Configuration();
diff --git a/temp-testng-customsuite.xml b/temp-testng-customsuite.xml
new file mode 100644
index 0000000..bda4467
--- /dev/null
+++ b/temp-testng-customsuite.xml
@@ -0,0 +1,8 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="rhq" parallel="">
+ <test verbose="2" name="org.rhq.core.pc.configuration.ConfigurationManagerTest" annotations="JDK">
+ <classes>
+ <class name="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ </classes>
+ </test>
+</suite>
commit 339b654559d8cfe788123ac92e658a4cc460d336
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 15:10:34 2010 +0100
Rename column name
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index fddf5c0..7614d7d 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -99,7 +99,7 @@
<column name="SENDER" required="false" size="200" type="VARCHAR2"/>
<column name="RESULT" required="false" size="20" type="VARCHAR2"/>
<column name="MESSAGE" required="false" size="255" type="VARCHAR2"/>
- <column name="EMAILS_SENT" required="false" size="4096" type="VARCHAR2"/>
+ <column name="ALL_EMAILS" required="false" size="4096" type="VARCHAR2"/>
<column name="EMAILS_FAILED" required="false" size="4096" type="VARCHAR2"/>
</table>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 9613a50..0242de1 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3027,7 +3027,7 @@
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="SENDER" columnType="VARCHAR2" precision="200" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="RESULT" columnType="VARCHAR2" precision="20" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="255" />
- <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_SENT" columnType="VARCHAR2" precision="4096" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="ALL_EMAILS" columnType="VARCHAR2" precision="4096" />
<schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_FAILED" columnType="VARCHAR2" precision="4096" />
</schemaSpec>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 367807c..373f380 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -95,13 +95,12 @@ public class AlertNotificationLog implements Serializable {
private String message;
- @Column(name="EMAILS_SENT")
- private String goodEmails;
+ @Column(name="ALL_EMAILS")
+ private String allEmails;
@Column(name="EMAILS_FAILED")
private String badEmails;
-
protected AlertNotificationLog() {
} // JPA
@@ -151,8 +150,8 @@ public class AlertNotificationLog implements Serializable {
return message;
}
- public String getGoodEmails() {
- return goodEmails;
+ public String getAllEmails() {
+ return allEmails;
}
public String getBadEmails() {
@@ -167,8 +166,8 @@ public class AlertNotificationLog implements Serializable {
this.message = message;
}
- public void setGoodEmails(String goodEmails) {
- this.goodEmails = goodEmails;
+ public void setAllEmails(String allEmails) {
+ this.allEmails = allEmails;
}
public void setBadEmails(String badEmails) {
commit 932abd746a50cf94ddbff4eca4161e8886bc8e32
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 14:36:14 2010 +0100
Use new constructors for AlertNotificationLog
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 4c830a5..367807c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -27,6 +27,8 @@ import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -87,7 +89,9 @@ public class AlertNotificationLog implements Serializable {
private String sender;
- private String result;
+ @Column(name ="RESULT")
+ @Enumerated(EnumType.STRING)
+ private ResultState result;
private String message;
@@ -101,17 +105,25 @@ public class AlertNotificationLog implements Serializable {
protected AlertNotificationLog() {
} // JPA
- public AlertNotificationLog(Alert alert, String sender, String result, String message) {
+ public AlertNotificationLog(Alert alert, String sender, SenderResult senderResult) {
this.alert = alert;
this.sender = sender;
- this.result = result;
- this.message = message;
+ this.result = senderResult.getState();
+ this.message = senderResult.getMessage();
}
public AlertNotificationLog(Alert alert, String sender) {
this.alert = alert;
this.sender = sender;
- this.result = "FAILURE"; // Default if nothing specified
+ this.result = ResultState.FAILURE; // Default if nothing specified
+ }
+
+ public AlertNotificationLog(Alert alert, String senderName, ResultState state, String message) {
+ this.alert = alert;
+ this.sender = sender;
+ this.result = state;
+ this.message = message;
+
}
public int getId() {
@@ -131,7 +143,7 @@ public class AlertNotificationLog implements Serializable {
return sender;
}
- public String getResult() {
+ public ResultState getResult() {
return result;
}
@@ -147,7 +159,7 @@ public class AlertNotificationLog implements Serializable {
return badEmails;
}
- public void setResult(String result) {
+ public void setResult(ResultState result) {
this.result = result;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 6b79d18..11e5569 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -692,22 +692,20 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
// TODO log result - especially handle the deferred_email case
log.info(result);
- alNoLo = new AlertNotificationLog(alert, senderName,
- result.getState().toString(),
- result.getMessage());
+ alNoLo = new AlertNotificationLog(alert, senderName, result);
}
catch (Throwable t) {
log.error("Sender failed: " + t.getMessage());
if (log.isDebugEnabled())
log.debug("Sender " + sender.toString() + "failed: \n", t);
alNoLo = new AlertNotificationLog(alert, senderName,
- "FAILED",
+ ResultState.FAILURE,
"Failed with exception: " + t.getMessage());
}
}
else {
alNoLo = new AlertNotificationLog(alert, senderName,
- "FAILED",
+ ResultState.FAILURE,
"Failed to obtain a sender with given name");
}
entityManager.persist(alNoLo);
commit e0d79cc3d190688001300f1eaa53cf074fe1d321
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 14:14:08 2010 +0100
Move ResultState and SenderResult to domain, so we can access it there.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java
new file mode 100644
index 0000000..f0f5ad9
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/ResultState.java
@@ -0,0 +1,33 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.core.domain.alert.notification;
+
+/**
+ * State of a SenderResult
+ * @author Heiko W. Rupp
+ * @see SenderResult
+ */
+public enum ResultState {
+ /** Success: sending of the notification was a success */
+ SUCCESS,
+ /** Deferred_email: this sender itself was successful, but l8er email sending may fail */
+ DEFERRED_EMAIL,
+ /** Failure: sending of the notification failed */
+ FAILURE
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SenderResult.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SenderResult.java
new file mode 100644
index 0000000..b4ec8e1
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SenderResult.java
@@ -0,0 +1,114 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.core.domain.alert.notification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The result of sending an alert notification via AlertSender#send()
+ * @author Heiko W. Rupp
+ */
+public class SenderResult {
+
+ /** Message returned for logging purposes */
+ private String message;
+ /** Was calling the AlertSender.send() method successful? */
+ private ResultState state;
+ /** A list of email addresses that should be notified */
+ private List<String> emails = new ArrayList<String>();
+
+ /**
+ * Default constructor. State is FAILURE by default
+ */
+ public SenderResult() {
+ this.message = "No message set";
+ this.state = ResultState.FAILURE;
+ }
+
+ public SenderResult(ResultState state, String message) {
+ this.message = message;
+ this.state = state;
+ }
+
+ public SenderResult(ResultState state, String message, List<String> emails) {
+ this.message = message;
+ this.state = state;
+ this.emails = emails;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public ResultState getState() {
+ return state;
+ }
+
+ public void setState(ResultState state) {
+ this.state = state;
+ }
+
+ public List<String> getEmails() {
+ return emails;
+ }
+
+ public void setEmails(List<String> emails) {
+ this.emails = emails;
+ }
+
+ public void addEmail(String email) {
+ emails.add(email);
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("SenderResult");
+ sb.append("{message='").append(message).append('\'');
+ sb.append(", state=").append(state);
+ sb.append(", emails=").append(emails);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ SenderResult that = (SenderResult) o;
+
+ if (message != null ? !message.equals(that.message) : that.message != null) return false;
+ if (state != that.state) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = message != null ? message.hashCode() : 0;
+ result = 31 * result + (state != null ? state.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index fb0d338..6b79d18 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -57,6 +57,7 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.AlertNotificationLog;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.AlertCriteria;
@@ -85,8 +86,7 @@ import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderPluginManager;
import org.rhq.enterprise.server.plugin.pc.alert.AlertServerPluginContainer;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
+import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSender.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSender.java
index d2f1ca1..c7fba26 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSender.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSender.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.plugin.pc.alert;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
import org.rhq.enterprise.server.plugin.pc.ServerPluginEnvironment;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/ResultState.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/ResultState.java
deleted file mode 100644
index 4355bde..0000000
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/ResultState.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2009 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.plugin.pc.alert;
-
-/**
- * State of a SenderResult
- * @author Heiko W. Rupp
- * @see SenderResult
- */
-public enum ResultState {
- /** Success: sending of the notification was a success */
- SUCCESS,
- /** Deferred_email: this sender itself was successful, but l8er email sending may fail */
- DEFERRED_EMAIL,
- /** Failure: sending of the notification failed */
- FAILURE
-}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/SenderResult.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/SenderResult.java
deleted file mode 100644
index 67b9f6c..0000000
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/SenderResult.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2009 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.plugin.pc.alert;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The result of sending an alert notification via AlertSender#send()
- * @author Heiko W. Rupp
- */
-public class SenderResult {
-
- /** Message returned for logging purposes */
- private String message;
- /** Was calling the AlertSender.send() method successful? */
- private ResultState state;
- /** A list of email addresses that should be notified */
- private List<String> emails = new ArrayList<String>();
-
- /**
- * Default constructor. State is FAILURE by default
- */
- public SenderResult() {
- this.message = "No message set";
- this.state = ResultState.FAILURE;
- }
-
- public SenderResult(ResultState state, String message) {
- this.message = message;
- this.state = state;
- }
-
- public SenderResult(ResultState state, String message, List<String> emails) {
- this.message = message;
- this.state = state;
- this.emails = emails;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public ResultState getState() {
- return state;
- }
-
- public void setState(ResultState state) {
- this.state = state;
- }
-
- public List<String> getEmails() {
- return emails;
- }
-
- public void setEmails(List<String> emails) {
- this.emails = emails;
- }
-
- public void addEmail(String email) {
- emails.add(email);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("SenderResult");
- sb.append("{message='").append(message).append('\'');
- sb.append(", state=").append(state);
- sb.append(", emails=").append(emails);
- sb.append('}');
- return sb.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- SenderResult that = (SenderResult) o;
-
- if (message != null ? !message.equals(that.message) : that.message != null) return false;
- if (state != that.state) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = message != null ? message.hashCode() : 0;
- result = 31 * result + (state != null ? state.hashCode() : 0);
- return result;
- }
-}
diff --git a/modules/enterprise/server/plugins/alert-email/src/main/java/org/rhq/enterprise/server/plugins/alertEmail/EmailSender.java b/modules/enterprise/server/plugins/alert-email/src/main/java/org/rhq/enterprise/server/plugins/alertEmail/EmailSender.java
index 94d2575..27bd0cb 100644
--- a/modules/enterprise/server/plugins/alert-email/src/main/java/org/rhq/enterprise/server/plugins/alertEmail/EmailSender.java
+++ b/modules/enterprise/server/plugins/alert-email/src/main/java/org/rhq/enterprise/server/plugins/alertEmail/EmailSender.java
@@ -19,22 +19,14 @@
package org.rhq.enterprise.server.plugins.alertEmail;
import java.util.Arrays;
-import java.util.Properties;
-
-import javax.mail.Message;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-
-import com.sun.mail.smtp.SMTPMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.SenderResult;
+import org.rhq.core.domain.alert.notification.ResultState;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
/**
* Class to send emails. Actually it does not do the work
diff --git a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
index 8cbd313..93eecc6 100644
--- a/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
+++ b/modules/enterprise/server/plugins/alert-irc/src/main/java/org/rhq/enterprise/server/plugins/alertIrc/IrcSender.java
@@ -22,10 +22,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
index a2795c8..257b315 100644
--- a/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
+++ b/modules/enterprise/server/plugins/alert-microblog/src/main/java/org/rhq/enterprise/server/plugins/alertMicroblog/MicroblogSender.java
@@ -26,10 +26,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
index b19a5e7..649d6ed 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
@@ -28,11 +28,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
index 7992fdd..dd0df4d 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
@@ -26,13 +26,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
index 8c12a8e..985d890 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
+++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/java/org.rhq.enterprise.server.plugins.alertScriptlang/ScriptLangSender.java
@@ -32,10 +32,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java b/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java
index 83c9a86..a3966be 100644
--- a/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java
@@ -43,12 +43,12 @@ import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
diff --git a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
index c70d6c6..3fd5d79 100644
--- a/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
+++ b/modules/enterprise/server/plugins/alert-snmp/src/main/java/org/rhq/enterprise/server/plugins/alertSnmp/SnmpSender.java
@@ -25,12 +25,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
import org.rhq.enterprise.server.plugins.alertSnmp.SnmpTrapSender;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
index 354db91..caaf79c 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
@@ -25,12 +25,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.notification.ResultState;
+import org.rhq.core.domain.alert.notification.SenderResult;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
-import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
-import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
import org.rhq.enterprise.server.util.LookupUtil;
/**
commit fd00621612f30f641671b3868ff28cfa6540fb9e
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 14:05:47 2010 +0100
Prepare for new version of alert notification logging.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index a3da84c..f91a292 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.77.3</db.schema.version>
+ <db.schema.version>2.77.4</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index 6a06d64..fddf5c0 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -96,9 +96,11 @@
<index name="RHQ_ALERT_IDX_ALERT" unique="true">
<field ref="ALERT_ID"/>
</index>
- <column name="ROLES" required="false" size="200" type="VARCHAR2"/>
- <column name="SUBJECTS" required="false" size="200" type="VARCHAR2"/>
- <column name="EMAILS" required="false" size="200" type="VARCHAR2"/>
+ <column name="SENDER" required="false" size="200" type="VARCHAR2"/>
+ <column name="RESULT" required="false" size="20" type="VARCHAR2"/>
+ <column name="MESSAGE" required="false" size="255" type="VARCHAR2"/>
+ <column name="EMAILS_SENT" required="false" size="4096" type="VARCHAR2"/>
+ <column name="EMAILS_FAILED" required="false" size="4096" type="VARCHAR2"/>
</table>
<table name="RHQ_ALERT_CONDITION_LOG" tablespace="@@@LARGE_TABLESPACE_FOR_DATA@@@"
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index c3d4006..9613a50 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1,3 +1,4 @@
+
<project name="db-upgrade" default="upgrade" basedir=".">
<!--
@@ -3018,6 +3019,18 @@
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="role_id"/>
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="subject_id"/>
</schemaSpec>
+ <schemaSpec version="2.77.4">
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="roles"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="subjects"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIF_LOG" column="emails"/>
+
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="SENDER" columnType="VARCHAR2" precision="200" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="RESULT" columnType="VARCHAR2" precision="20" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="MESSAGE" columnType="VARCHAR2" precision="255" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_SENT" columnType="VARCHAR2" precision="4096" />
+ <schema-addColumn table="RHQ_ALERT_NOTIF_LOG" column="EMAILS_FAILED" columnType="VARCHAR2" precision="4096" />
+
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
index 6b93414..3c63e0c 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
@@ -23,7 +23,9 @@
package org.rhq.core.domain.alert;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
@@ -111,10 +113,10 @@ import org.rhq.core.domain.auth.Subject;
+ " WHERE condition.measurementDefinition.id = :measurementDefinitionId " //
+ " AND definition.resource.id = ( :resourceId ) " //
+ " AND ( a.ctime BETWEEN :startDate AND :endDate )"),
- @NamedQuery(name = Alert.QUERY_GET_ALERT_COUNT_FOR_SCHEDULES, query = "SELECT sched.id, count(*) "
- + " FROM Alert AS a " + " JOIN a.alertDefinition aDef " + " JOIN aDef.conditions condition "
- + " JOIN aDef.resource res" + " JOIN condition.measurementDefinition mDef " + " JOIN mDef.schedules sched"
- + " WHERE sched.definition = mDef.id" + " AND sched.resource = res " + " AND sched.id IN (:schedIds) "
+ @NamedQuery(name = Alert.QUERY_GET_ALERT_COUNT_FOR_SCHEDULES, query = "SELECT sched.id, count(*) " +
+ " FROM Alert AS a JOIN a.alertDefinition aDef JOIN aDef.conditions condition " +
+ " JOIN aDef.resource res JOIN condition.measurementDefinition mDef JOIN mDef.schedules sched" +
+ " WHERE sched.definition = mDef.id AND sched.resource = res AND sched.id IN (:schedIds) "
+ " AND (a.ctime BETWEEN :startDate AND :endDate)" + "GROUP BY sched.id"),
@NamedQuery(name = Alert.QUERY_FIND_BY_RESOURCE_DATED, //
query = "SELECT a " //
@@ -231,8 +233,8 @@ public class Alert implements Serializable {
// primary key
private Set<AlertConditionLog> conditionLogs = new LinkedHashSet<AlertConditionLog>();
- @OneToOne(mappedBy = "alert")
- private AlertNotificationLog alertNotificationLog;
+ @OneToMany(mappedBy = "alert", cascade = CascadeType.ALL)
+ private List<AlertNotificationLog> alertNotificationLog = new ArrayList<AlertNotificationLog>();
@Deprecated
@Column(name = "TRIGGERED_OPERATION", nullable = true)
@@ -249,9 +251,6 @@ public class Alert implements Serializable {
@Column(name = "WILL_RECOVER", nullable = false)
private boolean willRecover;
-
-
-
@Column(name ="ACK_TIME")
private long ackTime = -1;
@@ -311,13 +310,16 @@ public class Alert implements Serializable {
conditionLog.setAlert(this);
}
- public AlertNotificationLog getAlertNotificationLog() {
- return this.alertNotificationLog;
+ public List<AlertNotificationLog> getAlertNotificationLog() {
+ return alertNotificationLog;
}
- public void setAlertNotificationLog(AlertNotificationLog alertNotificationLog) {
+ public void setAlertNotificationLog(List<AlertNotificationLog> alertNotificationLog) {
this.alertNotificationLog = alertNotificationLog;
- alertNotificationLog.setAlert(this);
+ }
+
+ public void addAlertNotificatinLog(AlertNotificationLog log) {
+ this.alertNotificationLog.add(log);
}
public String getTriggeredOperation() {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index d122624..4c830a5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -22,18 +22,18 @@
*/
package org.rhq.core.domain.alert.notification;
+
import java.io.Serializable;
-import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
-import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
@@ -41,25 +41,23 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlTransient;
import org.rhq.core.domain.alert.Alert;
-import org.rhq.core.domain.alert.AlertDefinition;
@Entity
@NamedQueries( {
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_ALERT_CTIME, //
- query = "DELETE AlertNotificationLog anl " + //
- " WHERE anl.id IN ( SELECT a.alertNotificationLog.id " + //
- " FROM Alert a " + //
- " WHERE a.ctime BETWEEN :begin AND :end )"),
+ query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an WHERE a.ctime BETWEEN :begin AND :end)"),
+
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_RESOURCE, //
- query = "DELETE AlertNotificationLog anl " + //
- " WHERE anl.id IN ( SELECT a.alertNotificationLog.id " + //
- " FROM Alert a " + //
- " WHERE a.alertDefinition.resource.id = :resourceId )"),
+ query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an JOIN a.alertDefinition def " +
+ "WHERE def.resource.id = :resourceId)"),
+
@NamedQuery(name = AlertNotificationLog.QUERY_DELETE_BY_RESOURCES, //
- query = "DELETE AlertNotificationLog anl " + //
- " WHERE anl.id IN ( SELECT a.alertNotificationLog.id " + //
- " FROM Alert a " + //
- " WHERE a.alertDefinition.resource.id IN ( :resourceIds ) )") })
+ query = "DELETE AlertNotificationLog anl WHERE anl.id IN (" +
+ "SELECT an.id FROM Alert a JOIN a.alertNotificationLog an JOIN a.alertDefinition def " +
+ "WHERE def.resource.id IN ( :resourceIds ) )")
+ })
@SequenceGenerator(name = "RHQ_ALERT_NOTIF_LOG_ID_SEQ", sequenceName = "RHQ_ALERT_NOTIF_LOG_ID_SEQ")
@Table(name = "RHQ_ALERT_NOTIF_LOG")
@XmlAccessorType(XmlAccessType.FIELD)
@@ -81,68 +79,87 @@ public class AlertNotificationLog implements Serializable {
* note, currently there is no distinction between successful and failed notifications, but there should be in the
* future
*/
- @Column(name = "ROLES", nullable = false)
- private String roles;
-
- @Column(name = "SUBJECTS", nullable = false)
- private String subjects;
-
- @Column(name = "EMAILS", nullable = false)
- private String emails;
@JoinColumn(name = "ALERT_ID", referencedColumnName = "ID")
- @OneToOne
+ @ManyToOne
@XmlTransient
private Alert alert;
- protected AlertNotificationLog() {
- } // JPA
+ private String sender;
+
+ private String result;
+
+ private String message;
- public AlertNotificationLog(Alert alert) {
- AlertDefinition alertDefinition = alert.getAlertDefinition();
+ @Column(name="EMAILS_SENT")
+ private String goodEmails;
- List<AlertNotification> currentNotifications = alertDefinition.getAlertNotifications();
- for (AlertNotification notification : currentNotifications) {
- //((SnmpNotification)notification).
- // TODO: log that this type of AlertNotification is not supported yet for auditing
- }
+ @Column(name="EMAILS_FAILED")
+ private String badEmails;
- // always make sure each notification field is non-null by "fixing" it
+
+ protected AlertNotificationLog() {
+ } // JPA
+
+ public AlertNotificationLog(Alert alert, String sender, String result, String message) {
this.alert = alert;
- this.roles ="(none)";
- this.subjects ="(none)";
- this.emails ="(none)";
+ this.sender = sender;
+ this.result = result;
+ this.message = message;
}
- private String fixup(StringBuilder builder) {
- if (builder.length() == 0) {
- return "(none)";
- } else {
- return builder.toString();
- }
+ public AlertNotificationLog(Alert alert, String sender) {
+ this.alert = alert;
+ this.sender = sender;
+ this.result = "FAILURE"; // Default if nothing specified
}
public int getId() {
return id;
}
- public String getRoles() {
- return roles;
+
+ public Alert getAlert() {
+ return alert;
}
- public String getSubjects() {
- return subjects;
+ public void setAlert(Alert alert) {
+ this.alert = alert;
}
- public String getEmails() {
- return emails;
+ public String getSender() {
+ return sender;
}
- public Alert getAlert() {
- return alert;
+ public String getResult() {
+ return result;
}
- public void setAlert(Alert alert) {
- this.alert = alert;
+ public String getMessage() {
+ return message;
+ }
+
+ public String getGoodEmails() {
+ return goodEmails;
+ }
+
+ public String getBadEmails() {
+ return badEmails;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void setGoodEmails(String goodEmails) {
+ this.goodEmails = goodEmails;
+ }
+
+ public void setBadEmails(String badEmails) {
+ this.badEmails = badEmails;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 599d4f3..fb0d338 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -22,6 +22,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
@@ -127,7 +128,6 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
@javax.annotation.Resource(name = "RHQ_DS")
private DataSource rhqDs;
- private static Date bootTime = null;
/**
* Persist a detached alert.
@@ -145,16 +145,25 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
/**
* Remove the alerts with the specified id's.
+ * @param user caller
+ * @param ids primary keys of the alerts to delete
+ * @return number of alerts deleted
*/
- private void deleteAlerts(Integer[] ids) {
+ public int deleteAlerts(Subject user, Integer[] ids) {
+ if (!authorizationManager.hasGlobalPermission(user,Permission.MANAGE_ALERTS))
+ throw new PermissionException("User [" + user.getName() + "] does not have permissions to delete alerts ");
+
+ int i = 0;
for (Integer id : ids) {
Alert alert = entityManager.find(Alert.class, id);
if (alert != null) {
- AlertNotificationLog anl = alert.getAlertNotificationLog();
- entityManager.remove(anl);
+// AlertNotificationLog anl = alert.getAlertNotificationLog(); TODO is that all?
+// entityManager.remove(anl);
entityManager.remove(alert); // condition logs will be removed with entity cascading
}
+ i++;
}
+ return i;
}
public void deleteAlerts(Subject user, int resourceId, Integer[] ids) {
@@ -163,7 +172,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
+ "for resourceId=" + resourceId);
}
- deleteAlerts(ids);
+ deleteAlerts(user, ids);
}
public void deleteAlertsForResourceGroup(Subject user, int resourceGroupId, Integer[] ids) {
@@ -172,7 +181,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
+ "for groupId=" + resourceGroupId);
}
- deleteAlerts(ids);
+ deleteAlerts(user, ids);
}
// gonna use bulk delete, make sure we are in new tx to not screw up caller's hibernate session
@@ -557,6 +566,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
* @param user calling user
* @param resourceId resource the alerts happened on
* @param alertIds PKs of the alerts to ack
+ * @return number of alerts acknowledged
*/
public int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds) {
if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resourceId)) {
@@ -601,8 +611,8 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
this.createAlert(newAlert);
log.debug("New alert identifier=" + newAlert.getId());
- AlertNotificationLog alertNotifLog = new AlertNotificationLog(newAlert);
- entityManager.persist(alertNotifLog);
+// AlertNotificationLog alertNotifLog = new AlertNotificationLog(newAlert); TODO - is that all?
+// entityManager.persist(alertNotifLog);
List<AlertConditionLog> unmatchedConditionLogs = alertConditionLogManager
.getUnmatchedLogsByAlertDefinitionId(alertDefinitionId);
@@ -640,6 +650,12 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
}
+ /**
+ * This is the core of the alert sending process. For each AlertNotification that is hanging
+ * on the alerts definition, the sender is instantiated and its send() method called. If a sender
+ * returns a list of email addresses, those will be collected and sent at the end.
+ * @param alert the fired alert
+ */
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void sendAlertNotifications(Alert alert) {
/*
@@ -648,40 +664,71 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
*/
try {
log.debug("Sending alert notifications for " + alert.toSimpleString() + "...");
- Collection<AlertNotification> alertNotifications = alert.getAlertDefinition().getAlertNotifications();
+ List<AlertNotification> alertNotifications = alert.getAlertDefinition().getAlertNotifications();
Set<String> emailAddresses = new LinkedHashSet<String>();
+ List<AlertNotificationLog> logs = new ArrayList<AlertNotificationLog>();
for (AlertNotification alertNotification : alertNotifications) {
// Send over the new AlertSender plugins
- if (alertNotification.getSenderName()==null) {
- log.warn("Alert notification " + alertNotification + " has no sender name defined");
+ String senderName = alertNotification.getSenderName();
+ if (senderName ==null) {
+ log.error("Alert notification " + alertNotification + " has no sender name defined");
continue;
}
+ AlertNotificationLog alNoLo ;
AlertSender sender = getAlertSender(alertNotification);
+
if (sender != null) {
try {
SenderResult result = sender.send(alert);
if (result == null) {
- log.warn("- !! -- sender " + alertNotification.getSenderName() +
- " did not return a SenderResult. Please fix this -- !! - ");
+ log.warn("- !! -- sender [" + senderName +
+ "] did not return a SenderResult. Please fix this -- !! - ");
} else if (result.getState() == ResultState.DEFERRED_EMAIL) {
if (result.getEmails() != null && !result.getEmails().isEmpty())
emailAddresses.addAll(result.getEmails());
}
// TODO log result - especially handle the deferred_email case
log.info(result);
+ alNoLo = new AlertNotificationLog(alert, senderName,
+ result.getState().toString(),
+ result.getMessage());
}
catch (Throwable t) {
log.error("Sender failed: " + t.getMessage());
if (log.isDebugEnabled())
log.debug("Sender " + sender.toString() + "failed: \n", t);
+ alNoLo = new AlertNotificationLog(alert, senderName,
+ "FAILED",
+ "Failed with exception: " + t.getMessage());
}
}
+ else {
+ alNoLo = new AlertNotificationLog(alert, senderName,
+ "FAILED",
+ "Failed to obtain a sender with given name");
+ }
+ entityManager.persist(alNoLo);
+ alert.addAlertNotificatinLog(alNoLo);
+ logs.add(alNoLo);
}
- sendAlertNotificationEmails(alert, emailAddresses);
+ // send them off
+ Collection<String> badAddresses = sendAlertNotificationEmails(alert, emailAddresses);
+ // TODO we may do the same for SMS in the future.
+
+ // TODO log those bad addresses to the gui and their individual senders (if possible)
+ if (!badAddresses.isEmpty()) {
+ for (int i = 0; i < alertNotifications.size(); i++) {
+ AlertNotification notification = alertNotifications.get(i);
+ // fill in badAdd if needed
+ }
+ }
+
+
+
} catch (Exception e) {
log.error("Failed to send all notifications for " + alert.toSimpleString(), e);
}
@@ -705,19 +752,13 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
return sender;
}
- private void processEmailAddress(Alert alert, String emailAddress, Set<String> emailAddresses) {
- if (emailAddress == null) {
- return;
- }
-
- emailAddress = emailAddress.toLowerCase();
-
- if (!emailAddresses.contains(emailAddress)) {
- emailAddresses.add(emailAddress);
- }
- }
-
- private void sendAlertNotificationEmails(Alert alert, Set<String> emailAddresses) {
+ /**
+ *
+ * @param alert
+ * @param emailAddresses
+ * @return
+ */
+ private Collection<String> sendAlertNotificationEmails(Alert alert, Set<String> emailAddresses) {
log.debug("Sending alert notifications for " + alert.toSimpleString() + "...");
AlertDefinition alertDefinition = alert.getAlertDefinition();
@@ -728,12 +769,15 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
String messageSubject = alertMessage.keySet().iterator().next();
String messageBody = alertMessage.values().iterator().next();
- try {
- emailManager.sendEmail(emailAddresses, messageSubject, messageBody);
- log.debug("All notifications for " + alert.toSimpleString() + " succeeded");
- } catch (Throwable t) {
- log.error("One or more notifications for " + alert.toSimpleString() + " failed: " + t.getMessage());
+ Collection<String> badAddresses;
+ badAddresses = emailManager.sendEmail(emailAddresses, messageSubject, messageBody);
+ if (log.isDebugEnabled()) {
+ if (badAddresses.isEmpty())
+ log.debug("All notifications for " + alert.toSimpleString() + " succeeded");
+ else
+ log.debug("Sending email notifications for " + badAddresses + " failed");
}
+ return badAddresses;
}
private static String NEW_LINE = System.getProperty("line.separator");
@@ -970,7 +1014,7 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
@SuppressWarnings("unchecked")
public PageList<Alert> findAlertsByCriteria(Subject subject, AlertCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
- if (authorizationManager.isInventoryManager(subject) == false) {
+ if (!authorizationManager.isInventoryManager(subject)) {
generator.setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType.RESOURCE,
"alertDefinition.resource", subject.getId());
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
index a148bf9..996f245 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
@@ -123,6 +123,15 @@ public interface AlertManagerLocal {
* @param user calling user
* @param resourceId resource the alerts happened on
* @param alertIds PKs of the alerts to ack
+ * @return number of alerts acknowledged
*/
int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds);
+
+ /**
+ * Remove the alerts with the specified id's.
+ * @param user caller
+ * @param ids primary keys of the alerts to delete
+ * @return number of alerts deleted
+ */
+ int deleteAlerts(Subject user, Integer[] ids);
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
index 9075c0e..965cbb9 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/alert/test/AlertManagerBeanTest.java
@@ -112,7 +112,7 @@ public class AlertManagerBeanTest extends AbstractEJB3Test {
Alert a = new Alert(ad, now);
em.persist(a);
- AlertNotificationLog anl = new AlertNotificationLog(a);
+ AlertNotificationLog anl = new AlertNotificationLog(a,"dummy");
em.persist(anl);
} catch (Exception e) {
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
index d6c5cc2..54aed90 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/scheduler/jobs/DataPurgeJobTest.java
@@ -423,7 +423,7 @@ public class DataPurgeJobTest extends AbstractEJB3Test {
Alert a = new Alert(ad, timestamp);
em.persist(a);
- AlertNotificationLog anl = new AlertNotificationLog(a);
+ AlertNotificationLog anl = new AlertNotificationLog(a,"dummy");
em.persist(anl);
AlertCondition ac = ad.getConditions().iterator().next();
commit 1a143f3a684e59a916d1cd20878003258a763c17
Merge: 7836e1d... 0b3d8fc...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 9 09:52:12 2010 +0100
Merge branch 'alertPlugin' of ssh://git.fedorahosted.org/git/rhq/rhq into alertPlugin
commit 5e485c51f51e24b81b1c04a060be31f63134dbd1
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Feb 8 22:03:37 2010 -0500
Adding support for simulating long running update operations
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index 57c9e24..da67206 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -11,8 +11,6 @@ import org.apache.commons.configuration.PropertiesConfiguration
class StructuredAndRawServer extends ConfigurationServer implements ResourceComponent, ResourceConfigurationFacet {
- ResourceContext resourceContext
-
File rawConfigDir
File rawConfigSubdir1
@@ -179,6 +177,11 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
if (failValidation.getBooleanValue()) {
throw new RuntimeException("Update failed for $configuration");
}
+
+ def delay = resourceContext.pluginConfiguration.getSimple("structuredUpdateDelay")
+ if (delay) {
+ Thread.sleep(delay.longValue)
+ }
}
void persistRawConfiguration(RawConfiguration rawConfiguration) {
@@ -192,6 +195,11 @@ class StructuredAndRawServer extends ConfigurationServer implements ResourceComp
}
}
+ def delay = resourceContext.pluginConfiguration.getSimple("rawUpdateDelay")
+ if (delay) {
+ Thread.sleep(delay.longValue)
+ }
+
backupAndSave(rawConfiguration)
}
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index d468787..5eda9c9 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -14,14 +14,10 @@ import org.rhq.core.domain.configuration.PropertyList
class StructuredServer extends ConfigurationServer implements ResourceComponent, ResourceConfigurationFacet {
- ResourceContext resourceContext
-
File configDir
File structuredConfigFile
- def ant = new AntBuilder()
-
def simpleProperties = ["foo", "bar", "bam"]
void start(ResourceContext context) {
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index c0bcaf9..686e3e5 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -36,6 +36,22 @@
path does not need to be specified. Simple matching will be done starting from
the end of the path. For a path of /foo/bar.txt, you could specify bar.txt."/>
</c:group>
+
+ <c:group name="Operation Delays">
+ <c:simple-property name="structuredUpdateDelay"
+ type="integer"
+ required="false"
+ description="A delay specified in milliseconds to simulate a long running operation. This
+ delay will affect the structured update method, persistStructuredConfiguration."/>
+ <c:simple-property name="rawUpdateDelay"
+ type="integer"
+ required="false"
+ description="A delay specified in milliseconds to simulate a long running operation. This
+ delay will affect the raw update method, persistRawConfiguration. Note that
+ persistRawConfiguration is called once for each raw config file; so, if you
+ specify a delay of 5000 (i.e., 5 seconds) and there are 5 raw config files,
+ then this will result in a delay of 25 seconds."/>
+ </c:group>
</plugin-configuration>
<resource-configuration configurationFormat="both">
commit 6e4bca0a4b5eb50c15fd6382cd10fa4c3fcc095f
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Feb 8 21:07:56 2010 -0500
Refactoring some common code into new base class ConfigurationTestServer.groovy
Adding a new property to StructuredAndRawServer that is only represented in structured and not
in raw
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
new file mode 100644
index 0000000..97a9188
--- /dev/null
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/ConfigurationServer.groovy
@@ -0,0 +1,66 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.plugins.test.rawconfig
+
+import org.rhq.core.domain.configuration.Configuration
+import org.apache.commons.configuration.PropertiesConfiguration
+import org.rhq.core.domain.configuration.PropertySimple
+import org.rhq.core.pluginapi.inventory.ResourceContext
+import org.rhq.core.domain.configuration.RawConfiguration
+
+class ConfigurationServer {
+
+ ResourceContext resourceContext
+
+ def ant = new AntBuilder()
+
+ /**
+ * Returns a list of the simple properties having the specified names that are found in configFile. If no
+ * properties are found, then an empty list is returned. This method assumes that the properties are strings and as
+ * such does not handle other simple types.
+ */
+ def loadSimpleProperties(File configFile, List propertyNames) {
+ def properties = []
+ def propertiesConfiguration = new PropertiesConfiguration(configFile)
+
+ propertyNames.each { properties << new PropertySimple(it, propertiesConfiguration.getString(it)) }
+
+ return properties
+ }
+
+
+ /**
+ * Makes a copy of the current configuration file found on disk. The backup has the original name with the extension,
+ * '.orig' tacked onto the end. Then the configuration file is overwritten with the contents of rawConfiguration.
+ */
+ def backupAndSave(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
+ }
+
+}
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 ed97f48..304ef24 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
@@ -8,16 +8,12 @@ import org.rhq.core.domain.measurement.AvailabilityType
import org.rhq.core.pluginapi.inventory.ResourceContext
import groovy.util.AntBuilder
-class RawServer implements ResourceComponent, ResourceConfigurationFacet {
-
- ResourceContext resourceContext
+class RawServer extends ConfigurationServer implements ResourceComponent, ResourceConfigurationFacet {
File rawConfigDir
List rawConfigs = []
- def ant = new AntBuilder()
-
void start(ResourceContext context) {
resourceContext = context;
@@ -88,12 +84,7 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet {
throw new RuntimeException("Update failed for ${rawConfiguration.path}");
}
- 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
+ backupAndSave(rawConfiguration)
}
void validateStructuredConfiguration(Configuration configuration) {
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index a20901e..57c9e24 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -9,7 +9,7 @@ import org.rhq.core.domain.configuration.RawConfiguration
import org.rhq.core.domain.configuration.PropertySimple
import org.apache.commons.configuration.PropertiesConfiguration
-class StructuredAndRawServer implements ResourceComponent, ResourceConfigurationFacet {
+class StructuredAndRawServer extends ConfigurationServer implements ResourceComponent, ResourceConfigurationFacet {
ResourceContext resourceContext
@@ -21,10 +21,16 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
File rawConfig1
+ List rawConfig1PropertyNames = ["x", "y", "z", "structuredOnlyProperty"]
+
File rawConfig2
+ List rawConfig2PropertyNames = ["username", "password"]
+
File rawConfig3
+ List rawConfig3PropertyNames = ["rhq.server.hostname", "rhq.server.port"]
+
File rawConfig4
def ant = new AntBuilder()
@@ -42,7 +48,7 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
rawConfig4 = new File(rawConfigSubdir2, "structured-and-raw-test-4.txt")
createRawConfigDirs()
- createConfigFile(rawConfig1, ["x": "1", "y": "2", "z": "3"])
+ createConfigFile(rawConfig1, ["x": "1", "y": "2", "z": "3", "structuredOnlyProperty": "a structured property"])
createConfigFile(rawConfig2, ["username": "rhqadmin", "password": "rhqadmin"])
createConfigFile(rawConfig3, ["rhq.server.hostname": "localhost", "rhq.server.port": "7080"])
createConfigFile(rawConfig4, ["raw.only.x": "foo", "raw.only.y": "bar"])
@@ -76,35 +82,14 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
}
Configuration loadStructuredConfiguration() {
- def config = new Configuration()
-
- loadStructuredForRawConfig1(config)
- loadStructuredForRawConfig2(config)
- loadStructuredForRawConfig3(config)
-
- return config
- }
-
- def loadStructuredForRawConfig1(Configuration config) {
- def propertiesConfig = new PropertiesConfiguration(rawConfig1)
+ def properties = loadSimpleProperties(rawConfig1, rawConfig1PropertyNames)
+ properties.addAll(loadSimpleProperties(rawConfig2, rawConfig2PropertyNames))
+ properties.addAll(loadSimpleProperties(rawConfig3, rawConfig3PropertyNames))
- config.put(new PropertySimple("x", propertiesConfig.getString("x")))
- config.put(new PropertySimple("y", propertiesConfig.getString("y")))
- config.put(new PropertySimple("z", propertiesConfig.getString("z")))
- }
-
- def loadStructuredForRawConfig2(Configuration config) {
- def propertiesConfig = new PropertiesConfiguration(rawConfig2)
+ def configuration = new Configuration()
+ configuration.properties = properties
- config.put(new PropertySimple("username", propertiesConfig.getString("username")))
- config.put(new PropertySimple("password", propertiesConfig.getString("password")))
- }
-
- def loadStructuredForRawConfig3(Configuration config) {
- def propertiesConfig = new PropertiesConfiguration(rawConfig3)
-
- config.put(new PropertySimple("rhq.server.hostname", propertiesConfig.getString("rhq.server.hostname")))
- config.put(new PropertySimple("rhq.server.port", propertiesConfig.getString("rhq.server.port")))
+ return configuration
}
Set<RawConfiguration> loadRawConfigurations() {
@@ -185,7 +170,7 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
void validateStructuredConfiguration(Configuration config) {
def failValidation = resourceContext.pluginConfiguration.getSimple("failStructuredValidation")
if (failValidation.getBooleanValue()) {
- throw new RuntimeException("Validation failed for $confi153guration");
+ throw new RuntimeException("Validation failed for $config");
}
}
@@ -196,23 +181,18 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
}
}
- void persistRawConfiguration(RawConfiguration rawConfig) {
+ void persistRawConfiguration(RawConfiguration rawConfiguration) {
def failUpdate = resourceContext.pluginConfiguration.getSimple("failRawUpdate")
if (failUpdate.getBooleanValue()) {
def fileNames = resourceContext.pluginConfiguration.getSimple("filesToFailUpdate").stringValue.split()
- def match = fileNames.find { rawConfig.path.endsWith(it) }
+ def match = fileNames.find { rawConfiguration.path.endsWith(it) }
if (match) {
- throw new RuntimeException("Update failed for ${rawConfig.path}");
+ throw new RuntimeException("Update failed for ${rawConfiguration.path}");
}
}
- ant.copy(file: rawConfig.path, tofile: "${rawConfig.path}.orig")
- ant.delete(file: rawConfig.path)
-
- def file = new File(rawConfig.path)
- file.createNewFile()
- file << rawConfig.contents
+ backupAndSave(rawConfiguration)
}
}
\ No newline at end of file
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index c14133c..d468787 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -12,7 +12,7 @@ import groovy.util.AntBuilder
import org.rhq.core.domain.configuration.PropertyMap
import org.rhq.core.domain.configuration.PropertyList
-class StructuredServer implements ResourceComponent, ResourceConfigurationFacet {
+class StructuredServer extends ConfigurationServer implements ResourceComponent, ResourceConfigurationFacet {
ResourceContext resourceContext
@@ -59,17 +59,13 @@ class StructuredServer implements ResourceComponent, ResourceConfigurationFacet
}
Configuration loadStructuredConfiguration() {
- def propertiesConfig = new PropertiesConfiguration(structuredConfigFile)
- def config = new Configuration()
+ def configuration = new Configuration()
+ configuration.properties = loadSimpleProperties(structuredConfigFile, simpleProperties)
- loadSimpleProperties(config, propertiesConfig)
- loadComplexProperties(config, propertiesConfig)
- return config
- }
+ loadComplexProperties(configuration, new PropertiesConfiguration(structuredConfigFile))
- def loadSimpleProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
- simpleProperties.each { configuration.put(new PropertySimple(it, propertiesConfig.getString(it))) }
+ return configuration
}
def loadComplexProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index 59cc79c..c0bcaf9 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -39,13 +39,14 @@
</plugin-configuration>
<resource-configuration configurationFormat="both">
- <c:simple-property name="x"/>
- <c:simple-property name="y"/>
- <c:simple-property name="z"/>
- <c:simple-property name="username"/>
- <c:simple-property name="password"/>
- <c:simple-property name="rhq.server.hostname"/>
- <c:simple-property name="rhq.server.port"/>
+ <c:simple-property name="x" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="y" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="z" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="username" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="password" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="rhq.server.hostname" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="rhq.server.port" description="A simple property that is represented in both structured and raw"/>
+ <c:simple-property name="structuredOnlyProperty" description="A simple property that is represented only in structured"/>
</resource-configuration>
</server>
@@ -55,8 +56,8 @@
description="A fake server component that supports raw configuration">
<plugin-configuration>
- <c:simple-property name="failValidation" type="boolean" default="false"/>
- <c:simple-property name="failUpdate" type="boolean" default="false"/>
+ <c:simple-property name="failRawValidation" type="boolean" default="false"/>
+ <c:simple-property name="failRawUpdate" type="boolean" default="false"/>
</plugin-configuration>
<resource-configuration configurationFormat="raw"/>
@@ -68,8 +69,8 @@
description="A fake server component that supports structured configuration">
<plugin-configuration>
- <c:simple-property name="failValidation" type="boolean" default="false"/>
- <c:simple-property name="failUpdate" type="boolean" default="false"/>
+ <c:simple-property name="failStructuredValidation" type="boolean" default="false"/>
+ <c:simple-property name="failStructuredUpdate" type="boolean" default="false"/>
</plugin-configuration>
<resource-configuration configurationFormat="structured">
commit c1d0b0212aebc58a636fe564122ad49aab30afbd
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Feb 8 16:36:21 2010 -0500
Updating StructuredServer to support complex properties
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
index e210d8d..c14133c 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredServer.groovy
@@ -9,6 +9,8 @@ import org.rhq.core.domain.configuration.Configuration
import org.apache.commons.configuration.PropertiesConfiguration
import org.rhq.core.domain.configuration.RawConfiguration
import groovy.util.AntBuilder
+import org.rhq.core.domain.configuration.PropertyMap
+import org.rhq.core.domain.configuration.PropertyList
class StructuredServer implements ResourceComponent, ResourceConfigurationFacet {
@@ -20,6 +22,8 @@ class StructuredServer implements ResourceComponent, ResourceConfigurationFacet
def ant = new AntBuilder()
+ def simpleProperties = ["foo", "bar", "bam"]
+
void start(ResourceContext context) {
resourceContext = context
@@ -39,11 +43,11 @@ class StructuredServer implements ResourceComponent, ResourceConfigurationFacet
return null
}
- def properties = ["foo": "1", "bar": "2", "bam": "3"]
+ int index = 1
structuredConfigFile.createNewFile()
structuredConfigFile.withWriter { writer ->
- properties.each { key, value -> writer.writeLine("${key}=${value}") }
+ simpleProperties.each { writer.writeLine("${it} = ${index++}") }
}
}
@@ -58,13 +62,34 @@ class StructuredServer implements ResourceComponent, ResourceConfigurationFacet
def propertiesConfig = new PropertiesConfiguration(structuredConfigFile)
def config = new Configuration()
- config.put(new PropertySimple("foo", propertiesConfig.getString("foo")))
- config.put(new PropertySimple("bar", propertiesConfig.getString("bar")))
- config.put(new PropertySimple("bam", propertiesConfig.getString("bam")))
+ loadSimpleProperties(config, propertiesConfig)
+ loadComplexProperties(config, propertiesConfig)
return config
}
+ def loadSimpleProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
+ simpleProperties.each { configuration.put(new PropertySimple(it, propertiesConfig.getString(it))) }
+ }
+
+ def loadComplexProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
+ def listProperty = new PropertyList("listProperty")
+ def index = 0
+ def complexProperties = propertiesConfig.subset("listProperty.${index}")
+
+ while (!complexProperties.isEmpty()) {
+ def x = new PropertySimple("listProperty.x", complexProperties.getString("x"))
+ def y = new PropertySimple("listProperty.y", complexProperties.getString("y"))
+ def z = new PropertySimple("listProperty.z", complexProperties.getString("z"))
+
+ listProperty.add(new PropertyMap("listPropertyValues", x, y, z))
+
+ complexProperties = propertiesConfig.subset("listProperty.${++index}")
+ }
+
+ configuration.put(listProperty)
+ }
+
Set<RawConfiguration> loadRawConfigurations() {
null
}
@@ -90,10 +115,34 @@ class StructuredServer implements ResourceComponent, ResourceConfigurationFacet
def propertiesConfig = new PropertiesConfiguration(structuredConfigFile)
- configuration.properties.each { propertiesConfig.setProperty(it.name, it.stringValue) }
+ persistSimpleProperties(configuration, propertiesConfig)
+ persistComplexProperties(configuration, propertiesConfig)
+
propertiesConfig.save(file)
}
+ def persistSimpleProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
+ simpleProperties.each { propertyName ->
+ def property = configuration.getSimple(propertyName)
+ propertiesConfig.setProperty(property.name, property.stringValue)
+ }
+ }
+
+ def persistComplexProperties(Configuration configuration, PropertiesConfiguration propertiesConfig) {
+ def listProperty = configuration.getList("listProperty")
+
+ if (listProperty == null) {
+ return
+ }
+
+ for (i in 0 ..< listProperty.list.size()) {
+ def mapProperty = listProperty.list[i]
+ propertiesConfig.setProperty("listProperty.${i}.x", mapProperty.getSimpleValue("listProperty.x", null))
+ propertiesConfig.setProperty("listProperty.${i}.y", mapProperty.getSimpleValue("listProperty.y", null))
+ propertiesConfig.setProperty("listProperty.${i}.z", mapProperty.getSimpleValue("listProperty.z", null))
+ }
+ }
+
void persistRawConfiguration(RawConfiguration rawConfiguration) {
}
diff --git a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
index c4001c1..59cc79c 100644
--- a/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/raw-config-test/src/main/resources/META-INF/rhq-plugin.xml
@@ -76,6 +76,14 @@
<c:simple-property name="foo"/>
<c:simple-property name="bar"/>
<c:simple-property name="bam"/>
+
+ <c:list-property name="listProperty" required="false">
+ <c:map-property name="listPropertyValues">
+ <c:simple-property name="listProperty.x" displayName="listProperty.x"/>
+ <c:simple-property name="listProperty.y" displayName="listProperty.y"/>
+ <c:simple-property name="listProperty.z" displayName="listProperty.z"/>
+ </c:map-property>
+ </c:list-property>
</resource-configuration>
</server>
</plugin>
commit 0b3d8fc9d2a4d6701948386fb9ab3e36022a5681
Author: Justin Harris <jharris(a)redhat.com>
Date: Mon Feb 8 11:56:51 2010 -0500
Pulling out alert templating into a different modal dialog.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
index c3344d8..157fa30 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
@@ -67,6 +67,8 @@
<h:outputText value="Add New Alert Notification" />
<rich:componentControl for="addAlertPanel" attachTo="addAlertLink" operation="show" event="onclick" />
</h:outputLink>
+
+ <ui:insert name="actionButtons" />
</h:form>
</h:panelGroup>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 5bf3cf6..1172f3e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -152,19 +152,35 @@
</rich:panel>
</h:panelGrid>
- <ui:include src="notif/listAlertSender.xhtml">
+ <ui:decorate template="notif/listAlertSender.xhtml">
<ui:param name="redirect" value="/rhq/resource/alert/viewAlert.xhtml?ad=#{param.ad}" />
- </ui:include>
+ <ui:define name="actionButtons">
+ <br /><br />
+ <h:outputLink id="addAlertTemplateLink" styleClass="buttonmed" value="#">
+ <h:outputText value="Add Alert Notifications from Template" />
+ <rich:componentControl for="addAlertFromTemplatePanel"
+ attachTo="addAlertTemplateLink"
+ operation="show"
+ event="onclick" />
+ </h:outputLink>
+ </ui:define>
+ </ui:decorate>
+
+ <br />
+ <br />
+ <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}"/>
+ <h:outputText value="Back to Alert Definitions for Resource '#{alertDefinition.resource.name}'"/>
+ </h:outputLink>
- <!-- Temp -->
- <rich:panel id="addAlertFromTemplatePanel">
+ <rich:modalPanel id="addAlertFromTemplatePanel" moveable="false" autosized="true">
<f:facet name="header">
<h:outputText value="Add Alert Notifications from template"/>
</f:facet>
<h:form id="newNotificationsFromTemplateForm">
<input type="hidden" name="ad" value="${param.ad}"/>
- <div style="height: 100px;">
+ <div>
<h:selectOneMenu id="templateList" value="#{definitionNotificationsUIBean.selectedTemplate}">
<f:selectItems value="#{definitionNotificationsUIBean.notificationTemplates}"/>
</h:selectOneMenu>
@@ -175,21 +191,20 @@
<h:outputText value="Clear existing notifications"/>
</div>
+ <br />
<h:commandButton id="addTemplateButton"
- value="Add Alert Notification from Template"
+ value="Add Alert Notifications"
action="#{definitionNotificationsUIBean.addAlertSenderFromTemplate}"
styleClass="buttonmed"
style="margin-top: auto;">
</h:commandButton>
+
+ <h:outputLink id="alertTemplateCancelLink" styleClass="buttonmed" value="#" style="float: right; margin: 10px;">
+ <h:outputText value="Cancel" />
+ <rich:componentControl for="addAlertFromTemplatePanel" attachTo="alertTemplateCancelLink" operation="hide" event="onclick" />
+ </h:outputLink>
</h:form>
- </rich:panel>
-
- <br />
- <br />
- <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
- <f:param name="id" value="#{alertDefinition.resource.id}"/>
- <h:outputText value="Back to Alert Definitions for Resource '#{alertDefinition.resource.name}'"/>
- </h:outputLink>
+ </rich:modalPanel>
<rich:modalPanel id="editAlertDefinitionPanel" moveable="false" autosized="true">
<f:facet name="header">
@@ -215,9 +230,9 @@
<h:selectBooleanCheckbox id="alertEnabledInput" value="#{alertUIBean.alertDefinition.enabled}" />
</h:panelGrid>
- <h:outputLink id="cancelLink" styleClass="buttonmed" value="#" style="float: right;">
+ <h:outputLink id="editDefinitionCancelLink" styleClass="buttonmed" value="#" style="float: right;">
<h:outputText value="Cancel" />
- <rich:componentControl for="editAlertDefinitionPanel" attachTo="cancelLink" operation="hide" event="onclick" />
+ <rich:componentControl for="editAlertDefinitionPanel" attachTo="editDefinitionCancelLink" operation="hide" event="onclick" />
</h:outputLink>
<h:commandButton id="saveButton" value="Save Changes" styleClass="buttonmed" action="#{alertUIBean.saveAlertDefinition}" />
commit 253dcd0faf118a32672c44aa3891d8a3ba5f15ff
Author: Justin Harris <jharris(a)redhat.com>
Date: Mon Feb 8 11:56:13 2010 -0500
Taking out alert-sms until we can resolve maven issue.
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 25be782..53a00e2 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -46,7 +46,9 @@
<module>alert-microblog</module>
<module>alert-roles</module>
<module>alert-scriptlang</module>
+ <!-- Seeing strange issues with corrupt jar dependencies...
<module>alert-sms</module>
+ -->
<module>alert-snmp</module>
<module>alert-subject</module>
<module>cobbler</module>
commit 3c58c9c2e9f595af99088856fe5a698b7df6734f
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Mon Feb 8 10:58:59 2010 -0500
fix for fix for https://jira.jboss.org/jira/browse/JOPR-384
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
index 38b57e2..177e3bb 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
@@ -178,7 +178,7 @@ public class ManagedComponentUtils
}
}
- public static class PropertyNotFoundException extends Exception {
+ public static class PropertyNotFoundException extends RuntimeException {
public PropertyNotFoundException(String message) {
super(message);
}
commit a341ec0f486f41d34eaa61500b18061bb5a5346f
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Mon Feb 8 10:40:01 2010 -0500
make Dashboard, rather than Start page, the default page after login (https://bugzilla.redhat.com/562861)
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index c7466d1..718097a 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -363,7 +363,7 @@
<action path="/Logout"
type="org.rhq.enterprise.gui.authentication.LogoutAction">
- <forward name="success" path="/Start.do" redirect="true"/>
+ <forward name="success" path="/Dashboard.do" redirect="true"/>
</action>
<action path="/Login"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index d9e4078..b60976e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -473,10 +473,7 @@
</session-config>
<welcome-file-list>
- <welcome-file>index.xhtml</welcome-file>
- <welcome-file>Start.do</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>index.html</welcome-file>
+ <welcome-file>Dashboard.do</welcome-file>
</welcome-file-list>
<error-page>
commit 5b7bff6bcd1ff745c1949f05bdea9b0920d93863
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Mon Feb 8 10:24:13 2010 -0500
fix for https://jira.jboss.org/jira/browse/EMBJOPR-280
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
index 53b0367..befbda5 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/ApplicationServerComponent.java
@@ -27,7 +27,9 @@ import java.io.InputStream;
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -124,6 +126,13 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer
private static final Pattern METRIC_NAME_PATTERN = Pattern.compile("(.*)\\|(.*)\\|(.*)\\|(.*)");
+ public static final Map<String, String> NEW_PROPERTY_NAMES = new HashMap<String, String>();
+ static {
+ NEW_PROPERTY_NAMES.put("transactionCount", "numberOfTransactions");
+ NEW_PROPERTY_NAMES.put("commitCount", "numberOfCommittedTransactions");
+ NEW_PROPERTY_NAMES.put("rollbackCount", "numberOfApplicationRollbacks");
+ }
+
private final Log log = LogFactory.getLog(this.getClass());
private ResourceContext resourceContext;
@@ -253,11 +262,43 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer
} else {
component = ManagedComponentUtils.getManagedComponent(managementView, componentType, componentName);
}
- Serializable value = ManagedComponentUtils.getSimplePropertyValue(component, propertyName);
+
+ Serializable value = null;
+ boolean foundProperty = false;
+ try {
+ value = ManagedComponentUtils.getSimplePropertyValue(component, propertyName);
+ foundProperty = true;
+ } catch (ManagedComponentUtils.PropertyNotFoundException e) {
+ if (NEW_PROPERTY_NAMES.containsKey(propertyName)) {
+ String newPropertyName = NEW_PROPERTY_NAMES.get(propertyName);
+ try {
+ value = ManagedComponentUtils.getSimplePropertyValue(component, newPropertyName);
+ foundProperty = true;
+ } catch (ManagedComponentUtils.PropertyNotFoundException e1) {
+ // ignore
+ }
+ }
+ }
+
+ if (!foundProperty) {
+ if (NEW_PROPERTY_NAMES.containsKey(propertyName)) {
+ List<String> propertyNames = new ArrayList<String>(2);
+ propertyNames.add(propertyName);
+ propertyNames.add(NEW_PROPERTY_NAMES.get(propertyName));
+ log.error("Property with one of the following names was not found for ManagedComponent ["
+ + component + "]: " + propertyNames);
+ } else {
+ log.error("Property '" + propertyName + "' was not found for ManagedComponent ["
+ + component + "].");
+ }
+ continue;
+ }
+
if (value == null) {
log.debug("Null value returned for metric '" + metricName + "'.");
continue;
}
+
if (request.getDataType() == DataType.MEASUREMENT) {
Number number = (Number) value;
report.addData(new MeasurementDataNumeric(request, number.doubleValue()));
@@ -335,9 +376,10 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer
// ---------------------------------------------------------------
private void connectToProfileService() {
- if (this.connection != null)
+ if (this.connection != null) {
return;
- // TODO: Check for a defunct connection and if found try to reconnect.
+ }
+ // TODO: Check for a defunct connection and if found try to reconnect?
ProfileServiceConnectionProvider connectionProvider;
if (runningEmbedded()) {
connectionProvider = new LocalProfileServiceConnectionProvider();
@@ -349,6 +391,12 @@ public class ApplicationServerComponent implements ResourceComponent, ProfileSer
String credentials = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.CREDENTIALS, null);
connectionProvider = new RemoteProfileServiceConnectionProvider(namingURL, principal, credentials);
}
+ if (Thread.interrupted()) {
+ // In case we've been timed out by the component facet invoker, clear the interrupted status,
+ // so that when the below call to connect() tried to make a remote call, JBoss Remoting
+ // doesn't throw an InterruptedException and short circuit our attempts to reconnect.
+ log.debug("Ignoring facet timeout in order to reconnect to Profile Service.");
+ }
try {
this.connection = connectionProvider.connect();
} catch (RuntimeException e) {
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
index 4703ccb..38b57e2 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/util/ManagedComponentUtils.java
@@ -74,11 +74,12 @@ public class ManagedComponentUtils
}
public static Serializable getSimplePropertyValue(ManagedComponent component, String propertyName)
- {
+ throws PropertyNotFoundException {
ManagedProperty property = component.getProperty(propertyName);
- if (property == null)
- throw new IllegalStateException("Property named '" + propertyName + "' not found for ManagedComponent ["
+ if (property == null) {
+ throw new PropertyNotFoundException("Property named '" + propertyName + "' not found for ManagedComponent ["
+ component + "].");
+ }
MetaType metaType = property.getMetaType();
Serializable value;
if (metaType.isSimple())
@@ -176,4 +177,10 @@ public class ManagedComponentUtils
return (value != 0) ? value : type1.getSubtype().compareTo(type2.getSubtype());
}
}
+
+ public static class PropertyNotFoundException extends Exception {
+ public PropertyNotFoundException(String message) {
+ super(message);
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
index 3897a27..c50cd6b 100644
--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
@@ -1140,7 +1140,7 @@
<metric displayName="Transactions Rolled Back" property="MCBean|JTA|*|rollbackCount" measurementType="trendsup"
defaultInterval="600000" defaultOn="true" category="utilization"
- description="Number of transactions committed since last restart"/>
+ description="Number of transactions rolled back since last restart"/>
<event name="logEntry" description="an entry was appended to a log file"/>
commit 7836e1de7af5ccea87c99406032e0db8193fbf45
Merge: 6592276... cfb4fd5...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 8 16:03:32 2010 +0100
Merge branch 'alertPlugin' of ssh://git.fedorahosted.org/git/rhq/rhq into alertPlugin
commit cfb4fd578f81e2e884845b19feedfe1233bd49d1
Author: Justin Harris <jharris(a)redhat.com>
Date: Mon Feb 8 09:54:41 2010 -0500
* Refactoring a good portion of the new alerting UI code.
* Adding in LookupComponent of for Seam injection via the LookupUtil.
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index a4b964b..19a345f 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -375,12 +375,39 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
+ <!-- ============ Testing ========================-->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.6.4</version>
+ </dependency>
+
</dependencies>
<build>
<finalName>rhq-portal</finalName>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-1</version>
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
index 8407748..d46c114 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionComponent.java
@@ -18,29 +18,37 @@
*/
package org.rhq.enterprise.gui.alert;
+import java.io.Serializable;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
+@AutoCreate
@Scope(ScopeType.PAGE)
@Name("alertDefinition")
-public class AlertDefinitionComponent {
+public class AlertDefinitionComponent implements Serializable {
+ @In("#{webUser.subject}")
+ private Subject subject;
+ @In
+ private AlertDefinitionManagerLocal alertDefinitionManager;
@RequestParameter("ad")
- private int alertDefinitionId;
+ private Integer alertDefinitionId;
+ private AlertDefinition alertDefinition;
@Unwrap
public AlertDefinition lookupAlertDefinition() {
- AlertDefinitionManagerLocal definitionManager = LookupUtil.getAlertDefinitionManager();
- Subject subject = EnterpriseFacesContextUtility.getSubject();
+ if (this.alertDefinitionId != null) {
+ this.alertDefinition = this.alertDefinitionManager.getAlertDefinitionById(this.subject , this.alertDefinitionId);
+ }
- return definitionManager.getAlertDefinitionById(subject, this.alertDefinitionId);
+ return this.alertDefinition;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionNotificationStore.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionNotificationStore.java
new file mode 100644
index 0000000..d8a8c56
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertDefinitionNotificationStore.java
@@ -0,0 +1,55 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.gui.alert;
+
+import java.io.Serializable;
+import java.util.List;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
+
+(a)Scope(ScopeType.PAGE)
+@Name("alertDefinitionNotificationStore")
+public class AlertDefinitionNotificationStore implements AlertNotificationStore, Serializable {
+
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+ @In
+ private AlertDefinition alertDefinition;
+
+ public List<AlertNotification> lookupNotifications(Subject subject) {
+ return this.alertNotificationManager.getNotificationsForAlertDefinition(subject, this.alertDefinition.getId());
+ }
+
+ public AlertNotification addNotification(Subject subject, String senderType, String notificationName, Configuration configuration) {
+ return this.alertNotificationManager.addAlertNotification(subject,
+ this.alertDefinition.getId(), senderType, notificationName, configuration);
+ }
+
+ public void removeNotifications(Subject subject, Integer[] notificationIds) {
+ this.alertNotificationManager.removeNotifications(subject, this.alertDefinition.getId(), notificationIds);
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStore.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStore.java
new file mode 100644
index 0000000..cd1d790
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStore.java
@@ -0,0 +1,33 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.gui.alert;
+
+import java.util.List;
+import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+
+public interface AlertNotificationStore {
+
+ List<AlertNotification> lookupNotifications(Subject subject);
+
+ AlertNotification addNotification(Subject subject, String senderType, String notificationName, Configuration configuration);
+
+ void removeNotifications(Subject subject, Integer[] notificationIds);
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStoreSelector.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStoreSelector.java
new file mode 100644
index 0000000..cc051fb
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationStoreSelector.java
@@ -0,0 +1,36 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.gui.alert;
+
+import java.io.Serializable;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+
+@Name("alertNotificationStoreSelector")
+public class AlertNotificationStoreSelector implements Serializable {
+
+ @Out(scope=ScopeType.PAGE)
+ private AlertNotificationStore alertNotificationStore;
+
+ public void select(String storeName) {
+ this.alertNotificationStore = (AlertNotificationStore) Component.getInstance(storeName, true);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationTemplateStore.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationTemplateStore.java
new file mode 100644
index 0000000..d325956
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationTemplateStore.java
@@ -0,0 +1,68 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.gui.alert;
+
+import java.io.Serializable;
+import java.util.List;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.core.domain.alert.notification.AlertNotification;
+import org.rhq.core.domain.alert.notification.NotificationTemplate;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
+
+(a)Scope(ScopeType.PAGE)
+@Name("alertNotificationTemplateStore")
+public class AlertNotificationTemplateStore implements AlertNotificationStore, Serializable {
+
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+ private NotificationTemplate template;
+
+ public void setNotificationTemplate(NotificationTemplate template) {
+ this.template = template;
+ }
+
+ public List<AlertNotification> lookupNotifications(Subject subject) {
+ if (this.template != null) {
+ return this.alertNotificationManager.getNotificationsForTemplate(subject, this.template.getId());
+ }
+
+ return null;
+ }
+
+ public AlertNotification addNotification(Subject subject, String senderType, String notificationName, Configuration configuration) {
+ if (this.template != null) {
+ return alertNotificationManager.addAlertNotificationToTemplate(subject,
+ this.template.getName(), senderType, notificationName, configuration);
+ }
+
+ return null;
+ }
+
+ public void removeNotifications(Subject subject, Integer[] notificationIds) {
+ if (this.template != null) {
+ this.alertNotificationManager.removeNotificationsFromTemplate(subject, this.template.getId(), notificationIds);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
index b2b1df3..b7ef9d0 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertNotificationsUIBean.java
@@ -29,19 +29,15 @@ import java.util.TreeMap;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
-import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.notification.AlertNotification;
-import org.rhq.core.domain.alert.notification.NotificationTemplate;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
-import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
/**
* Backing bean for Alert Sender Plugins configuration
@@ -53,20 +49,24 @@ import org.rhq.enterprise.server.util.LookupUtil;
public class AlertNotificationsUIBean implements Serializable {
private final static String SUCCESS_OUTCOME = "success";
- @RequestParameter("ad")
- private Integer alertDefinitionId;
+
@RequestParameter("nid")
private Integer notificationId;
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+ @In
+ private AlertNotificationStore alertNotificationStore;
+ @In("#{webUser.subject}")
+ private Subject subject;
+
private List<AlertNotification> alertNotifications;
private Set<AlertNotification> selectedNotifications;
private String newAlertName;
private String selectedNewSender;
- private String selectedTemplate;
- private Boolean clearExistingNotifications;
private AlertNotification activeNotification;
private ConfigurationDefinition activeConfigDefinition;
private AlertNotificationConverter notificationConverter;
- private AlertNotificationManagerLocal alertNotificationManager;
+ private Map<String, String> alertSenders;
public List<AlertNotification> getAlertNotifications() {
return alertNotifications;
@@ -100,22 +100,6 @@ public class AlertNotificationsUIBean implements Serializable {
this.selectedNewSender = selectedNewSender;
}
- public String getSelectedTemplate() {
- return selectedTemplate;
- }
-
- public void setSelectedTemplate(String selectedTemplate) {
- this.selectedTemplate = selectedTemplate;
- }
-
- public Boolean getClearExistingNotifications() {
- return clearExistingNotifications;
- }
-
- public void setClearExistingNotifications(Boolean clearExistingNotifications) {
- this.clearExistingNotifications = clearExistingNotifications;
- }
-
public AlertNotification getActiveNotification() {
return activeNotification;
}
@@ -134,6 +118,10 @@ public class AlertNotificationsUIBean implements Serializable {
return notificationConverter;
}
+ public Map<String, String> getAlertSenders() {
+ return this.alertSenders;
+ }
+
private void lookupActiveConfigDefinition() {
if (this.activeNotification != null) {
String senderName = this.activeNotification.getSenderName();
@@ -141,22 +129,13 @@ public class AlertNotificationsUIBean implements Serializable {
}
}
- public AlertDefinition getAlertDefinition() {
- AlertDefinitionManagerLocal definitionManager = LookupUtil.getAlertDefinitionManager();
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
- return definitionManager.getAlertDefinitionById(subject, alertDefinitionId);
- }
-
@Create
public void initNotifications() {
- this.alertNotificationManager = LookupUtil.getAlertNotificationManager();
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
- this.alertNotifications = this.alertNotificationManager.getNotificationsForAlertDefinition(subject, alertDefinitionId);
+ this.alertNotifications = this.alertNotificationStore.lookupNotifications(this.subject);
this.selectedNotifications = new HashSet<AlertNotification>();
this.notificationConverter = new AlertNotificationConverter();
this.notificationConverter.setAlertNotifications(alertNotifications);
+ this.alertSenders = lookupAlertSenders();
selectActiveNotification();
}
@@ -176,7 +155,7 @@ public class AlertNotificationsUIBean implements Serializable {
}
}
- public Map<String, String> getAllAlertSenders() {
+ private Map<String, String> lookupAlertSenders() {
Map<String, String> result = new TreeMap<String, String>();
for (String sender : this.alertNotificationManager.listAllAlertSenders()) {
@@ -187,7 +166,6 @@ public class AlertNotificationsUIBean implements Serializable {
}
public String addAlertSender() {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
Configuration newSenderConfig = null;
ConfigurationDefinition configDefinition = this.alertNotificationManager.getConfigurationDefinitionForSender(selectedNewSender);
@@ -197,16 +175,7 @@ public class AlertNotificationsUIBean implements Serializable {
newSenderConfig = new Configuration();
}
- this.activeNotification = this.alertNotificationManager.addAlertNotification(subject, alertDefinitionId, selectedNewSender, newAlertName, newSenderConfig);
-
- return SUCCESS_OUTCOME;
- }
-
- public String addAlertSenderFromTemplate() {
-
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
- alertNotificationManager.applyNotificationTemplateToAlertDefinition(getSelectedTemplate(),alertDefinitionId,getClearExistingNotifications());
+ this.activeNotification = this.alertNotificationStore.addNotification(this.subject, this.selectedNewSender, this.newAlertName, newSenderConfig);
return SUCCESS_OUTCOME;
}
@@ -220,10 +189,9 @@ public class AlertNotificationsUIBean implements Serializable {
}
public String removeSelected() {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
List<Integer> ids = getSelectedIds(this.selectedNotifications);
- alertNotificationManager.removeNotifications(subject, alertDefinitionId, toArray(ids));
+ this.alertNotificationStore.removeNotifications(this.subject, toArray(ids));
return SUCCESS_OUTCOME;
}
@@ -253,16 +221,4 @@ public class AlertNotificationsUIBean implements Serializable {
private Integer[] toArray(List<Integer> intList) {
return intList.toArray(new Integer[intList.size()]);
}
-
- public Map<String, String> getAllNotificationTemplates() {
- Map<String, String> result = new TreeMap<String, String>();
-
- List<NotificationTemplate> templates = alertNotificationManager.listNotificationTemplates(EnterpriseFacesContextUtility.getSubject());
-
- for (NotificationTemplate nt : templates) {
- String tmp = nt.getName() + " (" + nt.getDescription() + ")";
- result.put(tmp,nt.getName()); // displayed text, option value
- }
- return result;
- }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
index 4b01d25..48f3cee 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/AlertUIBean.java
@@ -19,10 +19,10 @@
package org.rhq.enterprise.gui.alert;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.faces.model.SelectItem;
-import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.In;
@@ -36,11 +36,9 @@ import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertDefinitionUpdateException;
import org.rhq.enterprise.server.alert.InvalidAlertDefinitionException;
-import org.rhq.enterprise.server.util.LookupUtil;
/**
*
@@ -48,17 +46,23 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
@Scope(ScopeType.PAGE)
@Name("alertUIBean")
-public class AlertUIBean {
+public class AlertUIBean implements Serializable {
@Logger
private Log log;
+ @In("#{webUser.subject}")
+ private Subject subject;
@In
private FacesMessages facesMessages;
@In
private AlertDescriber alertDescriber;
- private List<String> alertConditions;
+ @In
+ private AlertDefinitionManagerLocal alertDefinitionManager;
+ @In
private AlertDefinition alertDefinition;
+ private List<String> alertConditions;
private String alertDampening;
+ private List<SelectItem> priorities;
public String getAlertDampening() {
return this.alertDampening;
@@ -77,22 +81,13 @@ public class AlertUIBean {
}
public List<SelectItem> getPriorities() {
- List<SelectItem> items = new ArrayList<SelectItem>();
-
- for (AlertPriority priority : AlertPriority.values()) {
- items.add(new SelectItem(priority.name(), priority.getDisplayName()));
- }
-
- return items;
+ return this.priorities;
}
public String saveAlertDefinition() {
- // TODO: Use dependency injection to look these up
- AlertDefinitionManagerLocal definitionManager = LookupUtil.getAlertDefinitionManager();
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
try {
- definitionManager.updateAlertDefinition(subject, this.alertDefinition.getId(), this.alertDefinition, false);
+ alertDefinitionManager.updateAlertDefinition(this.subject,
+ this.alertDefinition.getId(), this.alertDefinition, false);
} catch (InvalidAlertDefinitionException e) {
facesMessages.add("There was an error finding the requested alert definition.");
log.error("Invalid alert definition: " + this.alertDefinition.toSimpleString(), e);
@@ -106,25 +101,34 @@ public class AlertUIBean {
@Create
public void init() {
- // Look this up from the Seam context instead of DI - this way the form submission updates
- // the defintion's values properly
- this.alertDefinition = (AlertDefinition) Component.getInstance("alertDefinition");
-
- lookupAlertConditions();
- lookupAlertDampening();
+ this.alertConditions = lookupAlertConditions();
+ this.alertDampening = lookupAlertDampening();
+ this.priorities = lookupPriorities();
}
- private void lookupAlertConditions() {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- this.alertConditions = new ArrayList<String>();
+ private List<String> lookupAlertConditions() {
+ List<String> conditions = new ArrayList<String>();
for (AlertCondition condition : this.alertDefinition.getConditions()) {
- this.alertConditions.add(this.alertDescriber.describeCondition(condition));
+ conditions.add(this.alertDescriber.describeCondition(condition));
}
+
+ return conditions;
}
- private void lookupAlertDampening() {
+ private String lookupAlertDampening() {
AlertDampening dampening = this.alertDefinition.getAlertDampening();
- this.alertDampening = this.alertDescriber.describeDampening(dampening);
+
+ return this.alertDescriber.describeDampening(dampening);
+ }
+
+ private List<SelectItem> lookupPriorities() {
+ List<SelectItem> items = new ArrayList<SelectItem>();
+
+ for (AlertPriority priority : AlertPriority.values()) {
+ items.add(new SelectItem(priority.name(), priority.getDisplayName()));
+ }
+
+ return items;
}
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
index f58a9a3..8b7c8d8 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
@@ -20,31 +20,29 @@ package org.rhq.enterprise.gui.alert;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.log.Log;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderInfo;
import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
-import org.rhq.enterprise.server.util.LookupUtil;
@Scope(ScopeType.PAGE)
@Name("customContentUIBean")
public class CustomContentUIBean {
- @Logger
- private Log log;
-
@RequestParameter
private String senderName;
- @RequestParameter
+ @RequestParameter("nid")
private Integer notificationId;
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+
private String contentUrl;
public String getContentUrl() {
@@ -53,7 +51,6 @@ public class CustomContentUIBean {
@Create
public void init() {
- AlertNotificationManagerLocal alertNotificationManager = LookupUtil.getAlertNotificationManager();
AlertSenderInfo info = alertNotificationManager.getAlertInfoForSender(this.senderName);
if (info != null && info.getUiSnippetUrl() != null) {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/DefinitionNotificationsUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/DefinitionNotificationsUIBean.java
new file mode 100644
index 0000000..502f567
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/DefinitionNotificationsUIBean.java
@@ -0,0 +1,109 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.gui.alert;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.notification.NotificationTemplate;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
+
+(a)Scope(ScopeType.PAGE)
+@Name("definitionNotificationsUIBean")
+public class DefinitionNotificationsUIBean implements Serializable {
+
+ @In
+ private AlertDefinition alertDefinition;
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+ @In("#{webUser.subject}")
+ private Subject subject;
+
+ private String selectedTemplate;
+ private Boolean clearExistingNotifications;
+ private Map<String, String> notificationTemplates;
+
+ public AlertDefinition getAlertDefinition() {
+ return alertDefinition;
+ }
+
+ public String getSelectedTemplate() {
+ return selectedTemplate;
+ }
+
+ public void setSelectedTemplate(String selectedTemplate) {
+ this.selectedTemplate = selectedTemplate;
+ }
+
+ public Boolean getClearExistingNotifications() {
+ return clearExistingNotifications;
+ }
+
+ public void setClearExistingNotifications(Boolean clearExistingNotifications) {
+ this.clearExistingNotifications = clearExistingNotifications;
+ }
+
+ public Map<String, String> getNotificationTemplates() {
+ return this.notificationTemplates;
+ }
+
+ public String addAlertSenderFromTemplate() {
+ this.alertNotificationManager.applyNotificationTemplateToAlertDefinition(getSelectedTemplate(),
+ this.alertDefinition.getId(), getClearExistingNotifications());
+
+ return "success";
+ }
+
+ @Create
+ public void init() {
+ this.notificationTemplates = lookupNotificationTemplates();
+ }
+
+ private Map<String, String> lookupNotificationTemplates() {
+ Map<String, String> result = new TreeMap<String, String>();
+ List<NotificationTemplate> templates = this.alertNotificationManager.listNotificationTemplates(this.subject);
+
+ for (NotificationTemplate template : templates) {
+ String displayName = getNotificationDisplayName(template);
+ result.put(displayName, template.getName()); // displayed text, option value
+ }
+
+ return result;
+ }
+
+ private String getNotificationDisplayName(NotificationTemplate template) {
+ StringBuilder builder = new StringBuilder(template.getName());
+
+ builder.append(" (");
+ builder.append(template.getDescription());
+ builder.append(")");
+
+ return builder.toString();
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
index 4f2c3d9..19bc895 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
@@ -20,20 +20,15 @@ package org.rhq.enterprise.gui.alert;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
import javax.faces.application.FacesMessage;
-import org.richfaces.model.selection.Selection;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
@@ -41,12 +36,9 @@ import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.NotificationTemplate;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.model.selection.SimpleSelection;
/**
* Backing bean for NotificationTemplates for Alert Sender Plugins configuration
@@ -55,108 +47,32 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Heiko Rupp
*/
@Scope(ScopeType.PAGE)
-@Name("notificationTemplateUIBean")
-@SuppressWarnings("unused")
+@Name("notificationTemplatesUIBean")
public class NotificationTemplatesUIBean implements Serializable {
- private final static String CONTINUE_OUTCOME = "continue";
- private final static String NEW_OUTCOME = "new";
- @RequestParameter("nid")
- private Integer notificationId;
+ private final static String SUCESS_OUTCOME = "success";
+
@RequestParameter("tid")
private Integer templateId;
- private String opMode;
- private List<AlertNotification> alertNotifications;
- private Set<AlertNotification> selectedNotifications;
- private String newAlertName;
+ @In("#{webUser.subject}")
+ private Subject subject;
+ @In
+ private AlertNotificationManagerLocal alertNotificationManager;
+ @In
+ private AlertNotificationTemplateStore alertNotificationTemplateStore;
+
private String newTemplateName;
private String newTemplateDescription;
- private String selectedNewSender;
- private Selection selectedTemplates;
- private Boolean clearExistingNotifications;
- private AlertNotification activeNotification;
- private NotificationTemplate activeTemplate;
- private ConfigurationDefinition activeConfigDefinition;
- private AlertNotificationConverter notificationConverter;
- private AlertNotificationManagerLocal alertNotificationManager;
- private static final String EDIT = "EDIT";
private List<NotificationTemplate> notificationTemplates;
- NotificationTemplate selectedTemplate;
-
- public List<AlertNotification> getAlertNotifications() {
- return alertNotifications;
- }
-
- public void setAlertNotifications(List<AlertNotification> alertNotifications) {
- this.alertNotifications = alertNotifications;
- }
-
- public Set<AlertNotification> getSelectedNotifications() {
- return selectedNotifications;
- }
-
- public void setSelectedNotifications(Set<AlertNotification> selectedNotifications) {
- this.selectedNotifications = selectedNotifications;
- }
-
- public String getNewAlertName() {
- return newAlertName;
- }
-
- public void setNewAlertName(String newAlertName) {
- this.newAlertName = newAlertName;
- }
-
- public String getSelectedNewSender() {
- return selectedNewSender;
- }
-
- public void setSelectedNewSender(String selectedNewSender) {
- this.selectedNewSender = selectedNewSender;
- }
-
- public Selection getSelectedTemplates() {
- return selectedTemplates;
- }
-
- public void setSelectedTemplates(Selection selectedTemplates) {
- this.selectedTemplates = selectedTemplates;
- System.out.println("Set selected templates " + selectedTemplates.toString());
- }
+ private SimpleSelection selectedTemplates;
+ private Integer selectedTemplateId;
- public Boolean getClearExistingNotifications() {
- return clearExistingNotifications;
- }
-
- public void setClearExistingNotifications(Boolean clearExistingNotifications) {
- this.clearExistingNotifications = clearExistingNotifications;
- }
-
- public AlertNotification getActiveNotification() {
- return activeNotification;
- }
-
- public void setActiveNotification(AlertNotification activeNotification) {
- System.out.println("setActiveNotification: " + activeNotification);
- this.activeNotification = activeNotification;
-
- lookupActiveConfigDefinition();
- }
-
- public NotificationTemplate getActiveTemplate() {
- return activeTemplate;
- }
-
- public void setActiveTemplate(NotificationTemplate activeTemplate) {
- this.activeTemplate = activeTemplate;
- }
-
- public ConfigurationDefinition getActiveConfigDefinition() {
- return activeConfigDefinition;
- }
+ public String getSelectedTemplateId() {
+ if (this.selectedTemplateId != null) {
+ return this.selectedTemplateId.toString();
+ }
- public AlertNotificationConverter getNotificationConverter() {
- return notificationConverter;
+ return null;
}
public String getNewTemplateName() {
@@ -175,73 +91,36 @@ public class NotificationTemplatesUIBean implements Serializable {
this.newTemplateDescription = newTemplateDescription;
}
- public String getOpMode() {
- return opMode;
- }
-
- public void setOpMode(String opMode) {
- this.opMode = opMode;
- }
-
- public NotificationTemplate getSelectedTemplate() {
- return selectedTemplate;
+ public SimpleSelection getSelectedTemplates() {
+ return selectedTemplates;
}
- public void setSelectedTemplate(NotificationTemplate selectedTemplate) {
- this.selectedTemplate = selectedTemplate;
+ public void setSelectedTemplates(SimpleSelection selectedTemplates) {
+ this.selectedTemplates = selectedTemplates;
}
public List<NotificationTemplate> getNotificationTemplates() {
return this.notificationTemplates;
}
- private void lookupActiveConfigDefinition() {
- System.out.println("lookupActiveConfigDef: activeNotification is " + activeNotification);
-
- if (this.activeNotification != null) {
- String senderName = this.activeNotification.getSenderName();
- this.activeConfigDefinition = this.alertNotificationManager.getConfigurationDefinitionForSender(senderName);
- }
- }
-
@Create
- public void initNotifications() {
- this.alertNotificationManager = LookupUtil.getAlertNotificationManager();
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
-// this.alertNotifications = this.alertNotificationManager.getNotificationsForAlertDefinition(subject, alertDefinitionId)
- this.alertNotifications = new ArrayList<AlertNotification>(); // TODO ?
- this.selectedNotifications = new HashSet<AlertNotification>();
- this.notificationConverter = new AlertNotificationConverter();
- this.notificationConverter.setAlertNotifications(alertNotifications);
- this.notificationTemplates = alertNotificationManager.listNotificationTemplates(EnterpriseFacesContextUtility.getSubject());
+ public void initNotificationTemplates() {
+ this.selectedTemplates = new SimpleSelection();
+ this.notificationTemplates = alertNotificationManager.listNotificationTemplates(this.subject);
selectActiveTemplate();
- selectActiveNotification();
}
private void selectActiveTemplate() {
if (this.templateId != null) {
- for (NotificationTemplate template : this.notificationTemplates) {
- if (template.getId() == this.templateId) {
- selectTemplate(template);
+ this.selectedTemplateId = this.templateId;
- return;
- }
- }
- }
-
- opMode = "";
- }
+ for (int i = 0; i < this.notificationTemplates.size(); i++) {
+ NotificationTemplate template = this.notificationTemplates.get(i);
- // Sets the initial state of the bean given the requrest parameters, this allows
- // us to maintain the selected item across requests.
- private void selectActiveNotification() {
- if (this.notificationId != null) {
- for (AlertNotification notification : this.alertNotifications) {
- if (notification.getId() == this.notificationId) {
- setActiveNotification(notification);
- this.selectedNotifications.add(notification);
+ if (template.getId() == this.templateId) {
+ this.selectedTemplates.addKey(i);
+ this.alertNotificationTemplateStore.setNotificationTemplate(template);
return;
}
@@ -249,162 +128,73 @@ public class NotificationTemplatesUIBean implements Serializable {
}
}
- public Map<String, String> getAllAlertSenders() {
- Map<String, String> result = new TreeMap<String, String>();
-
- for (String sender : this.alertNotificationManager.listAllAlertSenders()) {
- result.put(sender, sender);
- }
-
- return result;
- }
-
- public String addAlertSender() {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
-
- Configuration newSenderConfig = null;
- ConfigurationDefinition configDefinition = this.alertNotificationManager.getConfigurationDefinitionForSender(selectedNewSender);
-
- if (configDefinition != null) {
- newSenderConfig = configDefinition.getDefaultTemplate().createConfiguration();
- } else {
- newSenderConfig = new Configuration();
- }
+ public String createNotificationTemplate() {
try {
- this.activeNotification = alertNotificationManager.addAlertNotificationToTemplate(subject,selectedTemplate.getName(),selectedNewSender,newAlertName,newSenderConfig);
- System.out.println("addAlertSender: activeNotification is " + activeNotification);
- alertNotifications = alertNotificationManager.getNotificationsForTemplate(subject,selectedTemplate.getId());
- this.notificationConverter.setAlertNotifications(alertNotifications);
- selectedNotifications.clear();
- selectedNotifications.add(activeNotification);
- }
- catch (IllegalArgumentException iae) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,"Adding the sender failed: " + iae.getMessage() );
- }
+ NotificationTemplate template = alertNotificationManager.createNotificationTemplate(this.newTemplateName,
+ this.newTemplateDescription, new ArrayList<AlertNotification>(), true);
- return CONTINUE_OUTCOME;
- }
-
- public String saveConfiguration() {
- System.out.println("saveConfiguration: activeNotification is " + activeNotification);
-
- if (this.activeNotification != null) {
- this.alertNotificationManager.updateAlertNotification(this.activeNotification);
+ this.selectedTemplateId = template.getId();
+ } catch (IllegalArgumentException iae) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,"Creation of template failed: " + iae.getMessage());
}
- return CONTINUE_OUTCOME;
+ return SUCESS_OUTCOME;
}
- public String removeSelected() {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- List<Integer> ids = getSelectedIds(this.selectedNotifications);
- System.out.println("removeSelected: " + ids);
+ public String deleteNotificationTemplate() {
+ int numDeleted = alertNotificationManager.deleteNotificationTemplates(this.subject, getSelectedIds());
- alertNotificationManager.removeNotificationsFromTemplate(subject, selectedTemplate.getId(), toArray(ids));
+ String summary = getDeletionSummary(numDeleted);
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, summary);
- return CONTINUE_OUTCOME;
+ return null;
}
- public String saveOrder() {
- int orderIndex = 0;
+ private Integer[] getSelectedIds() {
+ List<Integer> selectedIds = new ArrayList<Integer>(selectedTemplates.size());
- for (AlertNotification notification : this.alertNotifications) {
- notification.setOrder(orderIndex++);
-
- // TODO: Wait and persist these all in a single operation?
- this.alertNotificationManager.updateAlertNotification(notification);
+ for (NotificationTemplate template : getSelectedTemplateList()) {
+ selectedIds.add(template.getId());
}
- return CONTINUE_OUTCOME;
- }
-
- private List<Integer> getSelectedIds(Collection<AlertNotification> notifications) {
- List<Integer> ids = new ArrayList<Integer>(notifications.size());
- for (AlertNotification notification : notifications) {
- ids.add(notification.getId());
- }
-
- return ids;
- }
-
- private Integer[] toArray(List<Integer> intList) {
- return intList.toArray(new Integer[intList.size()]);
+ return selectedIds.toArray(new Integer[selectedIds.size()]);
}
- public Map<String, String> getAllNotificationTemplates() {
- Map<String, String> result = new TreeMap<String, String>();
+ private String getDeletionSummary(int numberDeleted) {
+ StringBuilder builder = new StringBuilder("Deleted ");
- List<NotificationTemplate> templates = alertNotificationManager.listNotificationTemplates(EnterpriseFacesContextUtility.getSubject());
+ builder.append(numberDeleted);
+ builder.append(" template");
- for (NotificationTemplate nt : templates) {
- String tmp = nt.getName() + " (" + nt.getDescription() + ")";
- result.put(tmp,nt.getName()); // displayed text, option value
+ if (numberDeleted != 1) {
+ builder.append("s");
}
- return result;
- }
-
- public String createNotificationTemplate() {
-
- NotificationTemplate templ;
-
- try {
- templ = alertNotificationManager.createNotificationTemplate(newTemplateName,newTemplateDescription,new ArrayList<AlertNotification>(),
- true);
- selectedTemplate = templ;
- alertNotifications = selectedTemplate.getNotifications();
- } catch (IllegalArgumentException iae) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,"Creation of template failed: " + iae.getMessage());
- }
-
- return NEW_OUTCOME;
+ return builder.toString();
}
- public String deleteNotificationTemplate() {
+ public String editNotificationTemplate() {
+ List<NotificationTemplate> selected = getSelectedTemplateList();
- List<Integer> ids = new ArrayList<Integer>(selectedTemplates.size());
+ if (selected.size() == 1) {
+ this.selectedTemplateId = selected.get(0).getId();
- Iterator<Object> iter = selectedTemplates.getKeys();
- while (iter.hasNext()) {
- Integer row = (Integer) iter.next();
- NotificationTemplate templ = notificationTemplates.get(row);
- ids.add(templ.getId());
+ return SUCESS_OUTCOME;
}
-
- int num = alertNotificationManager.deleteNotificationTemplates(EnterpriseFacesContextUtility.getSubject(),
- ids.toArray(new Integer[ids.size()]));
-
- String summary = "Deleted " + num + " templates";
- if (num!=1)
- summary+="s";
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, summary);
-
- return NEW_OUTCOME;
+ return null;
}
- public void editNotificationTemplate() {
+ private List<NotificationTemplate> getSelectedTemplateList() {
+ List<NotificationTemplate> templateList = new ArrayList<NotificationTemplate>(selectedTemplates.size());
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- System.out.println("in edit Template");
- Iterator<Object> iter = selectedTemplates.getKeys();
- if (selectedTemplates.size()==1) {
- Integer row = (Integer) iter.next();
- selectTemplate(notificationTemplates.get(row));
+ Iterator rowKeys = this.selectedTemplates.getKeys();
+ while (rowKeys.hasNext()) {
+ Integer row = (Integer) rowKeys.next();
+ templateList.add(notificationTemplates.get(row));
}
- else {
- opMode = "";
- }
- }
-
- private void selectTemplate(NotificationTemplate template) {
- Subject subject = EnterpriseFacesContextUtility.getSubject();
- selectedTemplate = template;
- alertNotifications = alertNotificationManager.getNotificationsForTemplate(subject, selectedTemplate.getId());
- this.notificationConverter.setAlertNotifications(alertNotifications);
- System.out.println("Selected template is " + selectedTemplate);
- opMode = EDIT;
+ return templateList;
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util/LookupComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util/LookupComponent.java
new file mode 100644
index 0000000..31259a0
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/util/LookupComponent.java
@@ -0,0 +1,127 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.util;
+
+import java.beans.Introspector;
+import java.lang.reflect.Method;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.contexts.Context;
+import org.jboss.seam.core.Init;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * A common Seam component that wraps the {@link LookupUtil}, so that any Seam
+ * components can use the common DI mechanism to obtain EJB references.
+ *
+ * This component primarily exists to keep the JNDI lookup in the {@link LookupUtil}
+ * so that it will not conflict with Seam's JNDI lookup mechanism. Eventually, all
+ * session beans can simply be annotated as Seam components and the {@link LookupUtil}
+ * (as well as this component) can be deprecated.
+ *
+ * For every getter method defined in {@link LookupUtil}, a Seam component will
+ * be created that delegates component creation to that getter method.
+ *
+ * Example Usage:
+ * <code>public static ResourceManagerLocal getResourceManager()</code> will be
+ * called any time that a component with name "resourceManager" is injected:
+ *
+ * <code>@In private ResourceManagerLocal resourceManager;</code> is equivalent to
+ * <code>private ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();</code>
+ *
+ * @author Justin Harris
+ */
+@Startup
+(a)Scope(ScopeType.APPLICATION)
+@Name("lookupComponent")
+public class LookupComponent {
+
+ @In
+ private Init init;
+
+ @In
+ private Context applicationContext;
+
+ @Create
+ public void scanComponents() {
+ for (Method method : LookupUtil.class.getDeclaredMethods()) {
+ String methodName = method.getName();
+
+ // only worried about getters
+ if (methodName.startsWith("get")) {
+ String componentName = getPropertyName(methodName);
+ addComponent(componentName, method);
+ }
+ }
+ }
+
+ /**
+ * Returns e.g. "foo" for <code>getterMethodName</code> "getFoo"
+ *
+ * @param getterMethodName
+ * @return
+ */
+ private String getPropertyName(String getterMethodName) {
+ return Introspector.decapitalize(getterMethodName.substring(3));
+ }
+
+ /**
+ * Registers a new Seam component that uses the <code>creationMethod</code>
+ * to "instantiate" a component with the given <code>componentName</code>
+ *
+ * @param componentName
+ * @param creationMethod
+ */
+ private void addComponent(String componentName, Method creationMethod) {
+ LookupUtilComponent component = new LookupUtilComponent(componentName, creationMethod);
+ this.applicationContext.set(componentName + ".component", component);
+
+ // set the new component to @AutoCreate
+ this.init.addAutocreateVariable(componentName);
+ }
+
+ /**
+ * Custom Seam component that delegates component intantiation to a creation
+ * method. This is similar in concept to Seam @Factory methods.
+ */
+ class LookupUtilComponent extends Component {
+
+ private Method creationMethod;
+
+ Method getCreationMethod() {
+ return this.creationMethod;
+ }
+
+ private LookupUtilComponent(String name, Method creationMethod) {
+ super(Object.class, name);
+
+ this.creationMethod = creationMethod;
+ }
+
+ @Override
+ protected Object instantiate() throws Exception {
+ return this.creationMethod.invoke(null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
index a760608..1880730 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/alert-navigation.xml
@@ -88,7 +88,7 @@
<navigation-case>
<from-outcome>success</from-outcome>
- <to-view-id>/rhq/resource/alert/viewAlert.xhtml?id=#{param.id}&ad=#{param.ad}&nid=#{alertNotificationsUIBean.activeNotification.id}</to-view-id>
+ <to-view-id>/rhq/resource/alert/viewAlert.xhtml?ad=#{alertDefinition.id}&nid=#{alertNotificationsUIBean.activeNotification.id}</to-view-id>
<redirect />
</navigation-case>
@@ -96,11 +96,11 @@
</navigation-rule>
<navigation-rule>
- <from-view-id>*</from-view-id>
+ <from-view-id>/rhq/resource/alert/notif/customContent.xhtml</from-view-id>
<navigation-case>
<from-outcome>ALERT_NOTIFICATIONS</from-outcome>
- <to-view-id>/rhq/resource/alert/viewAlert.xhtml?id=#{param.id}&ad=#{param.ad}&nid=#{alertNotificationsUIBean.activeNotification.id}</to-view-id>
+ <to-view-id>#{param.redirect}</to-view-id>
<redirect />
</navigation-case>
@@ -111,20 +111,8 @@
<from-view-id>/rhq/resource/alert/notif/notificationTemplates.xhtml</from-view-id>
<navigation-case>
- <from-outcome>continue</from-outcome>
- <to-view-id>/rhq/resource/alert/notif/notificationTemplates.xhtml?nid=#{notificationTemplateUIBean.activeNotification.id}&tid=#{notificationTemplateUIBean.selectedTemplate.id}</to-view-id>
-
- <redirect />
- </navigation-case>
-
- </navigation-rule>
-
- <navigation-rule>
- <from-view-id>/rhq/resource/alert/notif/notificationTemplates.xhtml</from-view-id>
-
- <navigation-case>
- <from-outcome>new</from-outcome>
- <to-view-id>/rhq/resource/alert/notif/notificationTemplates.xhtml</to-view-id>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/rhq/resource/alert/notif/notificationTemplates.xhtml?nid=#{alertNotificationsUIBean.activeNotification.id}&tid=#{notificationTemplatesUIBean.selectedTemplateId}</to-view-id>
<redirect />
</navigation-case>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 371889b..acc7946 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -4,4 +4,7 @@
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.1.xsd">
+ <page view-id="/rhq/resource/alert/viewAlert.xhtml" action="#{alertNotificationStoreSelector.select('alertDefinitionNotificationStore')}" />
+
+ <page view-id="/rhq/resource/alert/notif/notificationTemplates.xhtml" action="#{alertNotificationStoreSelector.select('alertNotificationTemplateStore')}" />
</pages>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/customContent.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/customContent.xhtml
index f885b06..e9c1ea2 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/customContent.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/customContent.xhtml
@@ -22,8 +22,7 @@
<c:if test="#{not empty customContentUIBean.contentUrl}">
<h:form>
<input type="hidden" name="senderName" value="#{param.senderName}" />
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
+ <input type="hidden" name="redirect" value="#{param.redirect}&nid=#{param.nid}" />
<h:messages showDetail="true"
globalOnly="true"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
index 2412402..c3344d8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
@@ -14,17 +14,11 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<rich:panel id="existingAlertsPanel">
- <f:facet name="header">
- <h:outputText>Existing notifications for Resource '#{ResourceUIBean.name}' and alert definition '#{alertNotificationsUIBean.alertDefinition.name}':</h:outputText>
- </f:facet>
<a4j:region renderRegionOnly="true">
<h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
<h:panelGroup>
<h:form id="notificationListForm">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
<rich:orderingList value="#{alertNotificationsUIBean.alertNotifications}"
var="alertNotification"
selection="#{alertNotificationsUIBean.selectedNotifications}"
@@ -58,9 +52,6 @@
</h:form>
<h:form id="alertActionButtons">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
<h:commandButton id="saveAlertOrderButton"
value="Save Order"
action="#{alertNotificationsUIBean.saveOrder}"
@@ -87,9 +78,6 @@
</div>
<h:form id="alertConfig">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
<rich:panel rendered="#{not empty alertNotificationsUIBean.activeNotification.configuration.map}">
<f:facet name="header">
<h:outputText value="#{alertNotificationsUIBean.activeNotification.senderName} Configuration"/>
@@ -100,7 +88,7 @@
<h:commandButton id="saveConfigButton"
value="SAVE"
action="#{alertNotificationsUIBean.saveConfiguration}"
- styleClass="buttonmed"/>
+ styleClass="buttonmed" />
</rich:panel>
</h:form>
@@ -108,86 +96,53 @@
<div id="customContentArea"></div>
</h:panelGroup>
- <h:outputText id="senderName"
- style="display: none;"
- value="#{alertNotificationsUIBean.activeNotification.senderName}" />
- <h:outputText id="notificationId"
- style="display: none;"
- value="#{alertNotificationsUIBean.activeNotification.id}" />
</h:panelGrid>
+ <h:outputText id="senderName"
+ style="display: none;"
+ value="#{alertNotificationsUIBean.activeNotification.senderName}" />
+ <h:outputText id="notificationId"
+ style="display: none;"
+ value="#{alertNotificationsUIBean.activeNotification.id}" />
</a4j:region>
</rich:panel>
<rich:modalPanel id="addAlertPanel" moveable="false" autosized="true">
- <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
- <rich:panel id="addNewAlertPanel">
- <f:facet name="header">
- <h:outputText value="Add New Alert Notifications"/>
- </f:facet>
-
- <h:form id="newNotificationForm">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
- <div style="height: 100px;">
- <h:outputLabel for="alertNameInput" value="Alert Notification Name:" />
- <br />
- <h:inputText id="alertNameInput"
- value="#{alertNotificationsUIBean.newAlertName}"
- maxlength="100"
- required="true" />
-
- <h:message for="alertNameInput"
- infoClass="InfoBlock"
- warnClass="WarnBlock"
- errorClass="ErrorBlock"
- fatalClass="FatalBlock" />
- <br /><br />
-
- <h:outputLabel for="senderList" value="Alert Sender Type:" />
- <br />
- <h:selectOneMenu id="senderList" value="#{alertNotificationsUIBean.selectedNewSender}">
- <f:selectItems value="#{alertNotificationsUIBean.allAlertSenders}" />
- </h:selectOneMenu>
- </div>
-
- <h:commandButton id="addAlertButton"
- value="Add Alert Notification"
- action="#{alertNotificationsUIBean.addAlertSender}"
- styleClass="buttonmed">
- </h:commandButton>
- </h:form>
- </rich:panel>
-
- <rich:panel id="addAlertFromTemplatePanel">
- <f:facet name="header">
- <h:outputText value="Add Alert Notifications from template"/>
- </f:facet>
- <h:form id="newNotificationsFromTemplateForm">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
- <div style="height: 100px;">
- <h:selectOneMenu id="templateList" value="#{alertNotificationsUIBean.selectedTemplate}">
- <f:selectItems value="#{alertNotificationsUIBean.allNotificationTemplates}"/>
- </h:selectOneMenu>
-
- <br/>
-
- <h:selectBooleanCheckbox title="clearExisting" value="#{alertNotificationsUIBean.clearExistingNotifications}"/>
- <h:outputText value="Clear existing notifications"/>
- </div>
-
- <h:commandButton id="addTemplateButton"
- value="Add Alert Notification from Template"
- action="#{alertNotificationsUIBean.addAlertSenderFromTemplate}"
- styleClass="buttonmed"
- style="margin-top: auto;">
- </h:commandButton>
- </h:form>
- </rich:panel>
- </h:panelGrid>
+ <rich:panel id="addNewAlertPanel">
+ <f:facet name="header">
+ <h:outputText value="Add New Alert Notifications"/>
+ </f:facet>
+
+ <h:form id="newNotificationForm">
+ <div style="height: 100px;">
+ <h:outputLabel for="alertNameInput" value="Alert Notification Name:" />
+ <br />
+ <h:inputText id="alertNameInput"
+ value="#{alertNotificationsUIBean.newAlertName}"
+ maxlength="100"
+ required="true" />
+
+ <h:message for="alertNameInput"
+ infoClass="InfoBlock"
+ warnClass="WarnBlock"
+ errorClass="ErrorBlock"
+ fatalClass="FatalBlock" />
+ <br /><br />
+
+ <h:outputLabel for="senderList" value="Alert Sender Type:" />
+ <br />
+ <h:selectOneMenu id="senderList" value="#{alertNotificationsUIBean.selectedNewSender}">
+ <f:selectItems value="#{alertNotificationsUIBean.alertSenders}" />
+ </h:selectOneMenu>
+ </div>
+
+ <h:commandButton id="addAlertButton"
+ value="Add Alert Notification"
+ action="#{alertNotificationsUIBean.addAlertSender}"
+ styleClass="buttonmed">
+ </h:commandButton>
+ </h:form>
+ </rich:panel>
<h:outputLink id="notificationCancelLink" styleClass="buttonmed" value="#" style="float: right;">
<h:outputText value="Cancel" />
@@ -195,24 +150,16 @@
</h:outputLink>
</rich:modalPanel>
- <br />
- <br />
- <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
- <f:param name="id" value="#{param.id}"/>
- <h:outputText value="Back to Alert Definitions for Resource '#{ResourceUIBean.name}'"/>
- </h:outputLink>
-
-
-
<script type="text/javascript">
function updateCustomContent() {
var sender = $('senderName').innerHTML;
var notificationId = $('notificationId').innerHTML;
new Ajax.Updater('customContentArea',
- 'notif/customContent.xhtml',
+ '/rhq/resource/alert/notif/customContent.xhtml',
{ method: 'get',
- parameters: {'senderName': sender, 'ad': #{param.ad}, 'id': #{param.id},
- 'notificationId' : notificationId
+ parameters: {'senderName': sender,
+ 'nid' : notificationId,
+ 'redirect' : '#{redirect}'
}
});
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/notificationTemplates.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/notificationTemplates.xhtml
index 17f5128..19cfc47 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/notificationTemplates.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/notificationTemplates.xhtml
@@ -51,201 +51,71 @@
<h:outputText>View / edit existing notification templates</h:outputText>
</f:facet>
<h:form id="templatesListForm">
- <rich:scrollableDataTable value="#{notificationTemplateUIBean.notificationTemplates}"
- var="template"
- first="0"
- selection="#{notificationTemplateUIBean.selectedTemplates}"
- height="150px"
- width="400px"
- >
- <rich:column width="150px">
+ <rich:scrollableDataTable value="#{notificationTemplatesUIBean.notificationTemplates}"
+ var="template"
+ selection="#{notificationTemplatesUIBean.selectedTemplates}"
+ selectionMode="single"
+ height="150px"
+ onselectionchange="$('existingAlertsPanel').hide();">
+ <rich:column width="300px">
<f:facet name="header">
- <h:outputText value="Name"/>
+ <h:outputText value="Name" />
</f:facet>
<h:outputText value="#{template.name}"/>
</rich:column>
- <rich:column width="250px">
+ <rich:column width="400px">
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
- <h:outputText value="#{template.description}"/>
+ <h:outputText value="#{template.description}" />
</rich:column>
</rich:scrollableDataTable>
<h:commandButton id="editTemplateButton"
- value="Edit selected Template"
- action="#{notificationTemplateUIBean.editNotificationTemplate}"
- styleClass="buttonmed"/>
+ value="Edit selected Template"
+ action="#{notificationTemplatesUIBean.editNotificationTemplate}"
+ styleClass="buttonmed" />
<h:commandButton id="deleteTemplateButton"
- value="Delete selected Template"
- action="#{notificationTemplateUIBean.deleteNotificationTemplate}"
- styleClass="buttonmed"/>
+ value="Delete selected Template"
+ action="#{notificationTemplatesUIBean.deleteNotificationTemplate}"
+ styleClass="buttonmed" />
</h:form>
</rich:panel>
<rich:panel id="createNewTempaltePanel">
<f:facet name="header">
- <h:outputText><b>Create new Template</b></h:outputText>
+ <h:outputText><strong>Create new Template</strong></h:outputText>
</f:facet>
<h:form id="createNewTemplateForm">
<h:outputText>Name</h:outputText>
<br/>
- <h:inputText id="newTemplateNameInput" required="true" maxlength="100" value="#{notificationTemplateUIBean.newTemplateName}"/>
+ <h:inputText id="newTemplateNameInput" required="true" maxlength="100" value="#{notificationTemplatesUIBean.newTemplateName}"/>
<p/>
<h:outputText>Description</h:outputText>
<br/>
- <h:inputText id="newTemplateDescriptionInput" required="false" maxlength="100" value="#{notificationTemplateUIBean.newTemplateDescription}"/>
+ <h:inputText id="newTemplateDescriptionInput" required="false" maxlength="100" value="#{notificationTemplatesUIBean.newTemplateDescription}"/>
<p/>
<h:commandButton id="newTemplateButton"
- value="Create new Template"
- action="#{notificationTemplateUIBean.createNotificationTemplate}"
- styleClass="buttonmed"/>
+ value="Create new Template"
+ action="#{notificationTemplatesUIBean.createNotificationTemplate}"
+ styleClass="buttonmed"/>
</h:form>
</rich:panel>
</h:panelGrid>
- <rich:panel id="existingAlertsPanel" rendered="#{notificationTemplateUIBean.opMode == 'EDIT'}">
- <f:facet name="header">
- <h:outputText>Existing notifications for Notification Template '#{notificationTemplateUIBean.selectedTemplate.name}':</h:outputText>
- </f:facet>
- <h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
- <h:panelGroup>
- <h:form id="notificationListForm">
-
- <rich:orderingList value="#{notificationTemplateUIBean.alertNotifications}"
- var="alertNotification"
- selection="#{notificationTemplateUIBean.selectedNotifications}"
- activeItem="#{notificationTemplateUIBean.activeNotification}"
- converter="#{notificationTemplateUIBean.notificationConverter}"
- listWidth="250">
- <rich:column>
- <f:facet name="header">
- <h:outputText value="Alert Notifications (Select to Edit)" />
- </f:facet>
- <h:outputText value="#{alertNotification.name} (#{alertNotification.senderName})" />
- </rich:column>
-
- <a4j:support event="onclick"
- ignoreDupResponses="true"
- requestDelay="25"
- reRender="alertConfig,senderName"
- oncomplete="updateCustomContent();" />
- <a4j:support event="onkeyup"
- ignoreDupResponses="true"
- requestDelay="150"
- reRender="alertConfig,senderName"
- oncomplete="updateCustomContent();" />
- <a4j:support event="onorderchanged"
- ignoreDupResponses="true"
- requestDelay="250"
- reRender="senderName" />
- </rich:orderingList>
- </h:form>
-
- <h:form id="alertActionButtons">
- <input type="hidden" name="id" value="${param.id}"/>
- <input type="hidden" name="ad" value="${param.ad}"/>
-
- <h:commandButton id="saveAlertOrderButton"
- value="Save Order"
- action="#{notificationTemplateUIBean.saveOrder}"
- styleClass="buttonmed"/>
-
- <h:commandButton id="removeAlertButton"
- value="Remove Selected"
- action="#{notificationTemplateUIBean.removeSelected}"
- styleClass="buttonmed"/>
- </h:form>
- </h:panelGroup>
-
- <h:panelGroup>
- <h:form id="alertConfig">
-
- <rich:panel rendered="#{not empty notificationTemplateUIBean.activeNotification.configuration.map}">
- <f:facet name="header">
- <h:outputText value="#{notificationTemplateUIBean.activeNotification.senderName} Configuration"/>
- </f:facet>
- <onc:config configurationDefinition="#{notificationTemplateUIBean.activeConfigDefinition}"
- configuration="#{notificationTemplateUIBean.activeNotification.configuration}" />
-
- <h:commandButton id="saveConfigButton"
- value="SAVE"
- action="#{notificationTemplateUIBean.saveConfiguration}"
- styleClass="buttonmed"/>
- </rich:panel>
- </h:form>
-
- <!-- Custom plugin UI -->
- <div id="customContentArea"></div>
- </h:panelGroup>
- </h:panelGrid>
- </rich:panel>
-
- <rich:panel id="addAlertPanel" rendered="#{notificationTemplateUIBean.opMode == 'EDIT'}">
- <f:facet name="header">
- <h:outputText value="Add Alert Notification" />
- </f:facet>
-
- <h:form id="newNotificationForm">
-
- <h:outputLabel for="alertNameInput" value="Alert Notification Name:" />
- <br />
- <h:inputText id="alertNameInput"
- value="#{notificationTemplateUIBean.newAlertName}"
- maxlength="100"
- required="true" />
-
- <h:message for="alertNameInput"
- infoClass="InfoBlock"
- warnClass="WarnBlock"
- errorClass="ErrorBlock"
- fatalClass="FatalBlock" />
- <br /><br />
-
- <h:outputLabel for="senderList" value="Alert Sender Type:" />
- <br />
- <h:selectOneMenu id="senderList" value="#{notificationTemplateUIBean.selectedNewSender}">
- <f:selectItems value="#{notificationTemplateUIBean.allAlertSenders}" />
- </h:selectOneMenu>
- <br /><br />
-
- <h:commandButton id="addAlertButton"
- value="Add Alert Notification"
- action="#{notificationTemplateUIBean.addAlertSender}"
- styleClass="buttonmed">
- </h:commandButton>
-
- <a4j:support event="oncomplete"
- ignoreDupResponses="true"
- requestDelay="150"
- reRender="alertConfig,senderName"
- oncomplete="updateCustomContent();" />
- </h:form>
- </rich:panel>
-
- <br />
- <br />
-
- <h:outputText id="senderName"
- value="#{notificationTemplateUIBean.activeNotification.senderName}" />
- <script>
- function updateCustomContent() {
- var sender = $('senderName').innerHTML;
- new Ajax.Updater('customContentArea',
- 'customContent.xhtml',
- { method: 'get',
- parameters: {'senderName': sender}
- });
- }
+ <ui:include src="listAlertSender.xhtml">
+ <ui:param name="redirect" value="/rhq/resource/alert/notif/notificationTemplates.xhtml?tid=#{param.tid}" />
+ </ui:include>
- Event.observe(window, 'load', function() {
- updateCustomContent();
- });
- </script>
+ <c:if test="#{empty param.tid}">
+ <script type="text/javascript">
+ $('existingAlertsPanel').hide();
+ </script>
+ </c:if>
</ui:define>
</ui:composition>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
index 8716d01..5bf3cf6 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/viewAlert.xhtml
@@ -16,7 +16,7 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<ui:composition template="/rhq/layout/main.xhtml">
- <ui:param name="pageTitle" value="Definition for '#{alertDefinition.name}' on resource '#{ResourceUIBean.name}'"/>
+ <ui:param name="pageTitle" value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'"/>
<ui:define name="metaHeaders">
<style>
@@ -41,14 +41,13 @@
<ui:define name="breadcrumbs">
<h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
- <f:param name="id" value="#{param.id}"/>
+ <f:param name="id" value="#{alertDefinition.resource.id}"/>
<h:outputText>Alert Definitions</h:outputText>
</h:outputLink>
<h:outputText> > </h:outputText>
<h:outputLink value="viewAlert.xhtml">
- <f:param name="id" value="#{param.id}" />
<f:param name="ad" value="#{param.ad}" />
- <h:outputText value="Definition for '#{alertDefinition.name}' on resource '#{ResourceUIBean.name}'" />
+ <h:outputText value="Definition for '#{alertDefinition.name}' on resource '#{alertDefinition.resource.name}'" />
</h:outputLink>
</ui:define>
@@ -145,7 +144,7 @@
<h:outputLink id="editConditionsLink" styleClass="buttonmed" value="/alerts/Config.do">
<f:param name="mode" value="editConditions" />
<f:param name="ad" value="#{param.ad}" />
- <f:param name="id" value="#{param.id}" />
+ <f:param name="id" value="#{alertDefinition.resource.id}" />
<h:outputText value="Edit Alert Conditions" />
</h:outputLink>
@@ -153,7 +152,44 @@
</rich:panel>
</h:panelGrid>
- <ui:include src="notif/listAlertSender.xhtml" />
+ <ui:include src="notif/listAlertSender.xhtml">
+ <ui:param name="redirect" value="/rhq/resource/alert/viewAlert.xhtml?ad=#{param.ad}" />
+ </ui:include>
+
+ <!-- Temp -->
+ <rich:panel id="addAlertFromTemplatePanel">
+ <f:facet name="header">
+ <h:outputText value="Add Alert Notifications from template"/>
+ </f:facet>
+ <h:form id="newNotificationsFromTemplateForm">
+ <input type="hidden" name="ad" value="${param.ad}"/>
+
+ <div style="height: 100px;">
+ <h:selectOneMenu id="templateList" value="#{definitionNotificationsUIBean.selectedTemplate}">
+ <f:selectItems value="#{definitionNotificationsUIBean.notificationTemplates}"/>
+ </h:selectOneMenu>
+
+ <br/>
+
+ <h:selectBooleanCheckbox title="clearExisting" value="#{definitionNotificationsUIBean.clearExistingNotifications}"/>
+ <h:outputText value="Clear existing notifications"/>
+ </div>
+
+ <h:commandButton id="addTemplateButton"
+ value="Add Alert Notification from Template"
+ action="#{definitionNotificationsUIBean.addAlertSenderFromTemplate}"
+ styleClass="buttonmed"
+ style="margin-top: auto;">
+ </h:commandButton>
+ </h:form>
+ </rich:panel>
+
+ <br />
+ <br />
+ <h:outputLink value="/rhq/resource/alert/listAlertDefinitions.xhtml">
+ <f:param name="id" value="#{alertDefinition.resource.id}"/>
+ <h:outputText value="Back to Alert Definitions for Resource '#{alertDefinition.resource.name}'"/>
+ </h:outputLink>
<rich:modalPanel id="editAlertDefinitionPanel" moveable="false" autosized="true">
<f:facet name="header">
@@ -162,7 +198,6 @@
<h:form id="editAlertDefinitionForm">
<input type="hidden" name="ad" value="#{param.ad}" />
- <input type="hidden" name="id" value="#{param.id}" />
<h:panelGrid columns="2" border="1" cellpadding="5" style="margin: 15px;">
<h:outputLabel for="alertNameInput" value="Name: " />
diff --git a/modules/enterprise/gui/portal-war/src/test/groovy/org/rhq/enterprise/gui/util/LookupComponentTest.groovy b/modules/enterprise/gui/portal-war/src/test/groovy/org/rhq/enterprise/gui/util/LookupComponentTest.groovy
new file mode 100644
index 0000000..7e1f27a
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/test/groovy/org/rhq/enterprise/gui/util/LookupComponentTest.groovy
@@ -0,0 +1,92 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.util
+
+import java.lang.reflect.Method
+import org.jboss.seam.ScopeType
+import org.jboss.seam.contexts.BasicContext
+import org.jboss.seam.contexts.Context
+import org.jboss.seam.core.Init
+import org.rhq.enterprise.gui.util.LookupComponent.LookupUtilComponent
+import org.rhq.enterprise.server.util.LookupUtil
+import org.testng.AssertJUnit
+import org.testng.annotations.BeforeClass
+import org.testng.annotations.DataProvider
+import org.testng.annotations.Test
+
+public class LookupComponentTest {
+
+ def lookupComponent
+ def contextMap
+
+ @BeforeClass
+ void setUp() {
+ contextMap = [:]
+
+ lookupComponent = new LookupComponent()
+ lookupComponent.init = new Init()
+ lookupComponent.applicationContext = new BasicContext(ScopeType.APPLICATION, contextMap)
+
+ lookupComponent.scanComponents()
+ }
+
+ @DataProvider(name="components")
+ Object[][] createExpectedComponents() {
+ // Note: these are just arbitrary - feel free to add to the list
+ [
+ [ "activeConditionProducer.component", "activeConditionProducer", getMethod("getActiveConditionProducer") ],
+ [ "activeConditionConsumer.component", "activeConditionConsumer", getMethod("getActiveConditionConsumer") ],
+ [ "agentManager.component", "agentManager", getMethod("getAgentManager") ],
+ [ "alertConditionCacheManager.component", "alertConditionCacheManager", getMethod("getAlertConditionCacheManager") ],
+ [ "alertConditionManager.component", "alertConditionManager", getMethod("getAlertConditionManager") ],
+ [ "alertDefinitionManager.component", "alertDefinitionManager", getMethod("getAlertDefinitionManager") ],
+ [ "alertSubsystemManager.component", "alertSubsystemManager", getMethod("getAlertSubsystemManager") ],
+ [ "configurationManager.component", "configurationManager", getMethod("getConfigurationManager") ],
+ [ "emailManagerBean.component", "emailManagerBean", getMethod("getEmailManagerBean") ],
+ [ "resourceManager.component", "resourceManager", getMethod("getResourceManager") ],
+ ]
+ }
+
+ def getMethod(String methodName) {
+ return LookupUtil.class.getMethod(methodName)
+ }
+
+ @Test(dataProvider="components")
+ void componentExists(def expectedComponentName, def expectedName, def expectedMethod) {
+ def component = contextMap[expectedComponentName]
+
+ AssertJUnit.assertNotNull("The component: '" + expectedComponentName + "' should be in the application context.", component)
+ }
+
+ @Test(dataProvider="components")
+ void componentName(def expectedComponentName, def expectedName, def expectedMethod) {
+ def component = contextMap[expectedComponentName]
+
+ AssertJUnit.assertEquals("Created component should be named: " + expectedName, expectedName, component.getName())
+ }
+
+ @Test(dataProvider="components")
+ void componentMethod(def expectedComponentName, def expectedName, def expectedMethod) {
+ def component = contextMap[expectedComponentName]
+
+ AssertJUnit.assertEquals("The method: " + expectedMethod.toGenericString() + " should be called to create component: " + expectedName,
+ expectedMethod, component.getCreationMethod())
+ }
+
+}
\ No newline at end of file
commit 65922760e881e87be3460675c6023a7e987a6d81
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 8 11:36:08 2010 +0100
Remove unused import
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java
index abd8978..805a1aa 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/subsystem/AlertSubsystemManagerBean.java
@@ -36,7 +36,6 @@ import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.composite.AlertDefinitionComposite;
import org.rhq.core.domain.alert.composite.AlertHistoryComposite;
-import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -175,24 +174,7 @@ public class AlertSubsystemManagerBean implements AlertSubsystemManagerLocal {
}
public int deleteAlertHistories(Subject subject, Integer[] historyIds) {
- int removed = 0;
- for (Integer id : historyIds) {
- try {
- Alert alert = entityManager.find(Alert.class, id);
- if (alert != null) {
- AlertNotificationLog anl = alert.getAlertNotificationLog();
- entityManager.remove(anl);
- entityManager.remove(alert); // condition logs will be removed with entity cascading
- }
- removed++;
- } catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.error("Could not remove alert[id=" + id + "] from subsystme view: " + t.getMessage(), t);
- } else {
- log.error("Could not remove alert[id=" + id + "] from subsystme view: " + t.getMessage());
- }
- }
- }
+ int removed = alertManager.deleteAlerts(subject,historyIds);
return removed;
}
commit fb90a629ca983433273488b6c1e2fb0218756bc7
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 8 11:33:16 2010 +0100
Remove unused import
diff --git a/modules/enterprise/gui/alert-migration/src/main/java/org/rhq/helpers/alertMigration/MigrationServlet.java b/modules/enterprise/gui/alert-migration/src/main/java/org/rhq/helpers/alertMigration/MigrationServlet.java
index 8e9022e..9ac4b25 100644
--- a/modules/enterprise/gui/alert-migration/src/main/java/org/rhq/helpers/alertMigration/MigrationServlet.java
+++ b/modules/enterprise/gui/alert-migration/src/main/java/org/rhq/helpers/alertMigration/MigrationServlet.java
@@ -36,7 +36,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.notification.AlertNotification;
-import org.rhq.core.domain.alert.notification.AlertNotificationLog;
import org.rhq.core.domain.auth.Subject;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
commit c3898b412630082c27af0fd0063a462192ab1c62
Author: John Sanda <john(a)localhost.localdomain>
Date: Sun Feb 7 15:55:43 2010 -0500
Updating css, formatting and adding back keypress event code for text area
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
index 15be0a3..2676d48 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
@@ -69,7 +69,7 @@
.dr-pmenu-group-self-label { /* filename */
color: rgb(109, 120, 124);
font-family: sans-serif;
- font-size: 8px;
+ font-size: 9px;
white-space: nowrap;
}
@@ -86,7 +86,7 @@
.rich-pmenu-group-self-label { /* directory - Defines styles for panel menu group label */
font-family: sans-serif;
- font-size: 8px;
+ font-size: 9px;
color: rgb(102, 102, 102);
white-space: nowrap;
}
@@ -137,6 +137,29 @@
padding-left: 10px;
}
+.rawConfigUndoButton {
+ font-size: 9px;
+ font-weight: bold;
+ color: #666666;
+ background-color: #FFFFFF;
+ border: 1px solid #B0B0B0;
+ padding: 0px 5px;
+ cursor: pointer;
+ text-decoration: none
+}
+
+.rawConfigFileNameCol {
+ color: rgb(109, 120, 124);
+ font-family: sans-serif;
+ font-size: 9px;
+ white-space: nowrap;
+}
+
+.rawConfigUndoCol {
+ width: 25%;
+ text-align: right;
+}
+
.rawConfigFileHeader {
color: gray;
white-space: nowrap;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index 319c0da..4c75324 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -57,7 +57,28 @@
<c:otherwise>
<rich:panelMenuItem label=""
icon="#{rawConfigUIBean.icon}">
- <h:panelGroup>
+ <ui:remove>
+ <rich:layout>
+ <rich:layoutPanel position="left">
+ <h:outputLabel value="#{rawConfigUIBean.fileName}">
+ <a4j:support event="onmousedown"
+ onsubmit="cursor_wait()"
+ oncomplete="cursor_clear()"
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel,uploadWindow"/>
+ </h:outputLabel>
+ </rich:layoutPanel>
+ <rich:layoutPanel position="right">
+ <a4j:commandButton value="Undo"
+ styleClass="rawConfigUndoButton"
+ rendered="#{rawConfigUIBean.modified}"
+ action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
+ reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
+ </rich:layoutPanel>
+ </rich:layout>
+ </ui:remove>
+ <h:panelGrid columns="2" columnClasses="rawConfigFileNameCol, rawConfigUndoCol">
<h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onmousedown"
onsubmit="cursor_wait()"
@@ -67,11 +88,11 @@
reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel,uploadWindow"/>
</h:outputLabel>
<a4j:commandButton value="Undo"
- styleClass="buttonmed"
+ styleClass="rawConfigUndoButton"
rendered="#{rawConfigUIBean.modified}"
action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
- </h:panelGroup>
+ </h:panelGrid>
</rich:panelMenuItem>
</c:otherwise>
</c:choose>
@@ -80,10 +101,12 @@
</c:forEach>
</rich:panelMenu>
- <div class="raw-outer-table-left-col-footer">
- <br/>
- <div class="raw-outer-table-left-col-footer-content">* - Contains uncommitted changes.</div>
- </div>
+ <c:if test="#{!readOnly}">
+ <div class="raw-outer-table-left-col-footer">
+ <br/>
+ <div class="raw-outer-table-left-col-footer-content">* - Contains uncommitted changes.</div>
+ </div>
+ </c:if>
</rich:panel>
@@ -123,6 +146,12 @@
styleClass="rawConfigFileContents"
value="#{selectedRawUIBean.contents}"
readonly="#{readOnly}"/>
+ <c:if test="#{!readOnly}">
+ <a4j:support event="onkeyup"
+ ignoreDupeResponses="true"
+ reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
+ requestDelay="1000"/>
+ </c:if>
</rich:panel>
</h:panelGrid>
</h:panelGrid>
commit ca70d3180cd21ecfd6f7503984b9e103bd76ef1b
Author: John Sanda <john(a)localhost.localdomain>
Date: Sun Feb 7 14:41:16 2010 -0500
Adding css for modal editor
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
index c9466ab..15be0a3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
@@ -137,6 +137,13 @@
padding-left: 10px;
}
+.rawConfigFileHeader {
+ color: gray;
+ white-space: nowrap;
+ font-weight: bold;
+ font-family: sans-serif;
+}
+
.rawConfigFileContents {
font-family: sans-serif;
color: gray;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index b3f31b8..319c0da 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -114,8 +114,8 @@
<a4j:status id="selectedFileHeader"
startText="Loading #{selectedRawUIBean.path} ..."
stopText="#{selectedRawUIBean.path}"
- startStyle="color: gray; white-space: nowrap; font-weight: bold; font-family: sans-serif;"
- stopStyle="color: gray; white-space: nowrap; font-weight: bold; font-family: sans-serif;"/>
+ startStyleClass="rawConfigFileHeader"
+ stopStyleClass="rawConfigFileHeader"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index ba9985b..5949b58 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -26,7 +26,7 @@
<rich:modalPanel id="modalEditor" width="800" height="600">
<f:facet name="header">
<h:panelGroup>
- <h:outputText value="#{editor.modalEditorHeader}"/>
+ <h:outputText value="#{editor.modalEditorHeader}" styleClass="rawConfigFileHeader"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
@@ -37,6 +37,7 @@
</f:facet>
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="modalFileContents"
+ styleClass="rawConfigFileContents"
style="width:100%; height:100%; overflow:visible;"
rows="30"
cols="30"
commit af0a84c6c1ccd3e7e465d9ac5158d31d1f9a7a89
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sun Feb 7 18:41:01 2010 +0100
Allow to provide the default domain in preferenes
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
index 2ac994b..b19a5e7 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
@@ -128,8 +128,9 @@ public class MobicentsSender extends AlertSender {
}
baseUrl = baseUrl +telEnc;
if (kind==MobiKind.VOICE) {
- if (!tel.endsWith("@callwithus.com") && !tel.contains("@")) { // TODO parametrize
- baseUrl = baseUrl + "@callwithus.com";
+ if (!tel.contains("@")) { // Append domain from preferences if user has none provided
+ String domain = preferences.getSimpleValue("defaultVoipDomain","localhost");
+ baseUrl = baseUrl + "@" + domain;
}
}
// TODO SMS url
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
index ce8424a..dfb28f6 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -24,6 +24,9 @@
<c:simple-property name="mobicentsServerUrl" displayName="Mobicents server URL" type="longString"
default="http://localhost:8080/mobicents"
description="Base URL of the Mobicents server"/>
+ <c:simple-property name="defaultVoipDomain" default="localhost"
+ description="The domain of your VoIP provider (e.g. callwithus.com). This will be appended to numbers if no domain is given"
+ />
</serverplugin:plugin-configuration>
commit c852ea3e1b4341c98ae27b16b2c2b18190666fb9
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Sun Feb 7 18:26:13 2010 +0100
Only append default domain if no domain given.
diff --git a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
index 7444052..2ac994b 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
+++ b/modules/enterprise/server/plugins/alert-mobicents/src/main/java/org/rhq/enterprise/server/plugins/alertMobicents/MobicentsSender.java
@@ -128,7 +128,7 @@ public class MobicentsSender extends AlertSender {
}
baseUrl = baseUrl +telEnc;
if (kind==MobiKind.VOICE) {
- if (!tel.endsWith("@callwithus.com")) { // TODO parametrize
+ if (!tel.endsWith("@callwithus.com") && !tel.contains("@")) { // TODO parametrize
baseUrl = baseUrl + "@callwithus.com";
}
}
commit 27fa4686a298ecf8cc6c2505b001d456124a8fb8
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Feb 6 21:52:04 2010 -0500
First cut at CSS changes for raw config
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
index 6359d7e..c9466ab 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/layout/main-layout.xhtml
@@ -45,6 +45,117 @@
HTML, BODY { overflow: hidden; }
</style>
+
+<style type="text/css">
+
+.dr-pnl {
+ border-style: none;
+ padding: 0;
+}
+
+.dr-pnl-b {
+ border-color: white;
+ padding: 0;
+ margin: 0;
+}
+
+.dr-pnl-h { /* Files */
+ background-image: none;
+ background-color: rgb(164, 178, 185);
+ font-family: sans-serif;
+ font-size: 10px;
+}
+
+.dr-pmenu-group-self-label { /* filename */
+ color: rgb(109, 120, 124);
+ font-family: sans-serif;
+ font-size: 8px;
+ white-space: nowrap;
+}
+
+.rich-pmenu { /* Defines styles for panel menu */
+
+}
+.rich-pmenu-disabled-element { /* Defines styles for panel menu disabled element */
+
+}
+.rich-pmenu-group { /* styles for panel menu group */
+ background-image: none;
+ background-color: rgb(217, 223, 227);
+}
+
+.rich-pmenu-group-self-label { /* directory - Defines styles for panel menu group label */
+ font-family: sans-serif;
+ font-size: 8px;
+ color: rgb(102, 102, 102);
+ white-space: nowrap;
+}
+.rich-pmenu-item { /* Defines styles for panel menu item */
+ background-color: rgb(223, 228, 232);
+ color: rgb(217, 223, 227);
+ border-style: none;
+ margin: 0;
+ padding: 0;
+ padding-left: 15px;
+
+}
+.rich-pmenu-nowrap { /* Defines styles for panel menu wrapper */
+
+}
+.rich-pmenu-selected-element { /* Defines styles for panel menu selected element */
+ background-color: white;
+ font-style: normal;
+ font-weight: bold;
+ color: red;
+
+}
+.rich-pmenu-top-group { /* Defines styles for panel menu top group element */
+ padding-left: 15px;
+}
+.rich-pmenu-top-group-div { /* Defines styles for panel menu top group div element */
+ border-style: none;
+ border-bottom-style: dotted;
+ border-bottom-color: white;
+ margin: 0;
+ padding: 0;
+}
+
+.raw-outer-table-left-col {
+ background-color: rgb(217, 223, 227);
+}
+
+.raw-outer-table-left-col-footer {
+ background-color: rgb(217, 223, 227);
+ width: 100%;
+}
+
+.raw-outer-table-left-col-footer-content {
+ font-family: sans-serif;
+ font-size: 9px;
+ font-weight: bold;
+ color: gray;
+ padding-left: 10px;
+}
+
+.rawConfigFileContents {
+ font-family: sans-serif;
+ color: gray;
+ background-color: white;
+ border-style: solid;
+ border-width: thin;
+ border-color: rgb(102, 102, 102);
+ width: 100%;
+ height: 300px;
+ overflow-x: auto;
+ overflow-y: scroll;
+}
+
+
+
+ </style>
+
+
+
<link rel="stylesheet" type="text/css" media="screen" href="/css/tabular.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="/css/layout.css"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
index c73d50e..b3f31b8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -27,6 +27,8 @@
<h:panelGrid columns="2"
styleClass="raw-outer-table"
+ cellpadding="0"
+ cellspacing="0"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<rich:panel id="fileMenuPanel" style="width:100%">
<f:facet name="header">Files</f:facet>
@@ -77,33 +79,48 @@
</rich:panelMenuGroup>
</c:forEach>
</rich:panelMenu>
+
+ <div class="raw-outer-table-left-col-footer">
+ <br/>
+ <div class="raw-outer-table-left-col-footer-content">* - Contains uncommitted changes.</div>
+ </div>
+
</rich:panel>
<h:panelGrid columns="1" style="width:100%;">
<h:panelGrid columns="4" style="width:100%;">
<h:outputLabel value=" "/>
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
+ <h:outputLink value="#"
+ onclick="#{rich:component('modalEditor')}.show()"
+ style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
+ View Full Screen
+ </h:outputLink>
<h:outputLink value="#"
disabled="#{readOnly}"
- onclick="#{rich:component('uploadWindow')}.show()">
+ onclick="#{rich:component('uploadWindow')}.show()"
+ style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
Upload New
</h:outputLink>
- <h:commandLink action="#{editor['download']}" value="Download">
+ <h:commandLink action="#{editor['download']}"
+ value="Download"
+ style="white-space: nowrap; font-weight: normal; color: rgb(62, 118, 202);">
<h:graphicImage value="/images/download.png"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
<a4j:status id="selectedFileHeader"
startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
+ stopText="#{selectedRawUIBean.path}"
+ startStyle="color: gray; white-space: nowrap; font-weight: bold; font-family: sans-serif;"
+ stopStyle="color: gray; white-space: nowrap; font-weight: bold; font-family: sans-serif;"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
- style="width:100%"
+ styleClass="rawConfigFileContents"
value="#{selectedRawUIBean.contents}"
readonly="#{readOnly}"/>
</rich:panel>
commit de3c1ec93372310a2289a49651f0e5a8c9de05eb
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Feb 6 21:28:12 2010 -0500
Refactoring common code in edit.xhtml into shared templates
Renaming view-structured.xhtml to structured.xhtml as it is now used in both view.xhtml and in
edit.xhtml. Initial commit for raw.xhtml which is used in both view.xhtml and in edit.xhtml.
Updating rerendering logic for the modal editor so that making changes to the file in the
modal editor updates the file menu. And when clicking the undo button in the file menu, the
modal editor contents are also reset.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index a9c4f89..7448990 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -73,98 +73,9 @@ THIS TEXT WILL BE REMOVED.
<c:when test="${configurationEditor.rawSupported}">
<rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
<rich:tab label="Advanced Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
- columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <h:panelGrid columns="1">
- <rich:panel id="fileMenuPanel" style="width:100%">
- <f:facet name="header">Files</f:facet>
-
- <rich:panelMenu id="fileMenu"
- mode="ajax"
- expandMode="client"
- iconCollapsedGroup="/images/icn_tree_folder.gif"
- iconExpandedGroup="/images/icn_tree_folder.gif">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{selectedRawUIBean.path}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label=""
- icon="#{rawConfigUIBean.icon}">
- <h:panelGroup>
- <h:outputLabel value="#{rawConfigUIBean.fileName}">
- <a4j:support event="onmousedown"
- onsubmit="cursor_wait()"
- oncomplete="cursor_clear()"
- action="#{configurationEditor.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel"/>
- </h:outputLabel>
- <a4j:commandButton value="Undo"
- styleClass="buttonmed"
- rendered="#{rawConfigUIBean.modified}"
- action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel"/>
- </h:panelGroup>
- </rich:panelMenuItem>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
- <rich:panel style="border:none">
- <h:graphicImage url="/images/star_on_24.png"/>
- <h:outputText value="- Contains uncommitted changes"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
-
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
-
- <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
-
- <h:commandLink action="#{configurationEditor.download}" value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- </h:commandLink>
-
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
- </h:panelGrid>
-
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
- value="#{selectedRawUIBean.contents}"
- readonly="false">
- <a4j:support event="onkeyup"
- ignoreDupeResponses="true"
- reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
- requestDelay="1000"/>
- </h:inputTextarea>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup id="lowerCommitPanel" style="text-align:right">
- <h:outputText id="lowerChangedFilesLabel"
- value="#{configurationEditor.modifiedFilesMsg}"
- rendered="#{configurationEditor .rawMode}"
- style="padding-right:10px"/>
- <h:commandButton value="Commit"
- action="#{configurationEditor.updateConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure}"/>
- </h:panelGroup>
- </h:panelGrid>
+ <ui:include src="raw.xhtml">
+ <ui:param name="readOnly" value="false"/>
+ </ui:include>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -172,12 +83,11 @@ THIS TEXT WILL BE REMOVED.
<c:when test="${configurationEditor.structuredSupported}">
<rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
<rich:tab label="Basic Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
- configuration="#{resourceConfiguration}"
- nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
- nullConfigurationMessage="#{msg['resource.configuration.null']}"
- prevalidate="true"/>
+ <ui:include src="structured.xhtml">
+ <ui:param name="readOnly" value="false"/>
+ </ui:include>
+ <ui:remove>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell"
rendered="#{resourceConfiguration != null}">
<h:commandButton value="SAVE" action="#{configurationEditor.updateConfiguration}"
@@ -186,6 +96,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="RESET" type="reset" immediate="true"
title="Click to Reset Fields" styleClass="buttonmed"/>
</h:panelGrid>
+ </ui:remove>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -197,131 +108,40 @@ THIS TEXT WILL BE REMOVED.
valueChangeListener="#{configurationEditor.changeTabs}">
<rich:tab id="structuredTab"
label="Basic Mode"
- reRender="fileUpload,upperCommitPanel"
+ reRender="upperCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
- <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
- configuration="#{resourceConfiguration}"
- nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
- nullConfigurationMessage="#{msg['resource.configuration.null']}"
- prevalidate="true"/>
-
- <h:panelGrid columns="2"
- styleClass="buttons-table"
- columnClasses="button-cell"
- rendered="#{resourceConfiguration != null}">
- <h:commandButton value="SAVE"
- action="#{configurationEditor.updateConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure}"/>
- <h:commandButton value="RESET"
- type="reset"
- immediate="true"
- title="Click to Reset Fields"
- styleClass="buttonmed"/>
- </h:panelGrid>
+ <ui:include src="structured.xhtml">
+ <ui:param name="readOnly" value="false"/>
+ </ui:include>
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
- reRender="fileUpload,fileMenuPanel,upperCommitPanel,lowerCommitPanel"
+ reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
- columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <h:panelGrid columns="1">
- <rich:panel id="fileMenuPanel" style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu id="fileMenu"
- mode="ajax"
- expandMode="client"
- iconCollapsedGroup="/images/icn_tree_folder.gif"
- iconExpandedGroup="/images/icn_tree_folder.gif">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{selectedRawUIBean.path}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label=""
- icon="#{rawConfigUIBean.icon}">
- <h:panelGroup>
- <h:outputLabel value="#{rawConfigUIBean.fileName}">
- <a4j:support event="onmousedown"
- onsubmit="cursor_wait()"
- oncomplete="cursor_clear()"
- action="#{configurationEditor.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel"/>
- </h:outputLabel>
- <a4j:commandButton value="Undo"
- styleClass="buttonmed"
- rendered="#{rawConfigUIBean.modified}"
- action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel"/>
- </h:panelGroup>
- </rich:panelMenuItem>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
- <rich:panel style="border:none">
- <h:graphicImage url="/images/star_on_24.png"/>
- <h:outputText value="- Contains uncommitted changes"/>
- </rich:panel>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
-
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
-
- <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
-
- <h:commandLink action="#{configurationEditor.download}" value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- </h:commandLink>
-
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
- </h:panelGrid>
-
- <rich:panel id="fileContentsPanel" style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
- value="#{selectedRawUIBean.contents}"
- readonly="false">
- <a4j:support event="onkeyup"
- ignoreDupeResponses="true"
- reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
- requestDelay="1000"/>
- </h:inputTextarea>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup id="lowerCommitPanel" style="text-align:right">
- <h:outputText id="lowerChangedFilesLabel" value="#{configurationEditor.modifiedFilesMsg}"
- rendered="#{configurationEditor.displayChangedFilesLabel}"
- style="padding-right:10px"/>
- <h:commandButton value="Commit"
- action="#{configurationEditor.updateConfiguration}"
- title="Click to Save Changes"
- styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure}"/>
- </h:panelGroup>
- </h:panelGrid>
+ <ui:include src="raw.xhtml">
+ <ui:param name="readOnly" value="false"/>
+ </ui:include>
</rich:tab>
</rich:tabPanel>
</c:when>
</c:choose>
+ <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
+ <h:panelGroup id="lowerCommitPanel" style="text-align:right">
+ <h:outputText id="lowerChangedFilesLabel"
+ value="#{configurationEditor.modifiedFilesMsg}"
+ rendered="#{configurationEditor .rawMode}"
+ style="padding-right:10px"/>
+ <h:commandButton value="Commit"
+ action="#{configurationEditor.updateConfiguration}"
+ title="Click to Save Changes"
+ styleClass="buttonmed"
+ rendered="${ResourceUIBean.permissions.configure}"/>
+ </h:panelGroup>
+ </h:panelGrid>
+
<ui:include src="upload-modal.xhtml"/>
<ui:include src="view-raw-modal.xhtml">
<ui:param name="readOnly" value="false"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
new file mode 100644
index 0000000..c73d50e
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/raw.xhtml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:onc="http://jboss.org/on/component">
+
+ <c:if test="#{empty readOnly}">
+ <c:set var="readOnly" value="true"/>
+ </c:if>
+
+ <c:choose>
+ <c:when test="#{readOnly}">
+ <c:set var="editor" value="#{configurationViewer}"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="editor" value="#{configurationEditor}"/>
+ </c:otherwise>
+ </c:choose>
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+ columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel id="fileMenuPanel" style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="/images/icn_tree_folder.gif"
+ iconExpandedGroup="/images/icn_tree_folder.gif"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
+ <c:choose>
+ <c:when test="#{readOnly}">
+ <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
+ icon="/images/blank.png"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+ action="#{configurationViewer.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor"/>
+ </c:when>
+ <c:otherwise>
+ <rich:panelMenuItem label=""
+ icon="#{rawConfigUIBean.icon}">
+ <h:panelGroup>
+ <h:outputLabel value="#{rawConfigUIBean.fileName}">
+ <a4j:support event="onmousedown"
+ onsubmit="cursor_wait()"
+ oncomplete="cursor_clear()"
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel,uploadWindow"/>
+ </h:outputLabel>
+ <a4j:commandButton value="Undo"
+ styleClass="buttonmed"
+ rendered="#{rawConfigUIBean.modified}"
+ action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
+ reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel,modalFileContents"/>
+ </h:panelGroup>
+ </rich:panelMenuItem>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputLabel value=" "/>
+
+ <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
+
+ <h:outputLink value="#"
+ disabled="#{readOnly}"
+ onclick="#{rich:component('uploadWindow')}.show()">
+ Upload New
+ </h:outputLink>
+
+ <h:commandLink action="#{editor['download']}" value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+ value="#{selectedRawUIBean.contents}"
+ readonly="#{readOnly}"/>
+ </rich:panel>
+ </h:panelGrid>
+ </h:panelGrid>
+
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml
new file mode 100644
index 0000000..e23ad6b
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/structured.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:onc="http://jboss.org/on/component">
+
+ <c:if test="#{empty readOnly}">
+ <c:set var="readOnly" value="true"/>
+ </c:if>
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <onc:config
+ configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
+ readOnly="#{readOnly}"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
+ prevalidate="true"/>
+
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
index 274a6dd..6a412a1 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
@@ -8,7 +8,7 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <f:subview id="uploadSubview" rendered="#{configurationEditor.fileUploadAvailable}">
+ <f:subview id="uploadSubview">
<script type="text/javascript">
function prepareFormForUpload() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index f3c7406..ba9985b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -48,7 +48,7 @@
<a4j:commandButton value="Save"
action="#{configurationEditor.applyModalEditContents}"
rendered="#{!readOnly}"
- reRender="fileContents,fileMenu,lowerChangedFilesLabel,upperChangedFilesLabel"
+ reRender="fileContents,fileMenuPanel,lowerChangedFilesLabel,upperChangedFilesLabel"
styleClass="buttonmed"
onclick="#{rich:component('modalEditor')}.hide()"/>
<a4j:commandButton value="Cancel" onclick="#{rich:component('modalEditor')}.hide()" styleClass="buttonmed"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
deleted file mode 100644
index 0a105a2..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:onc="http://jboss.org/on/component">
-
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
- columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="/images/icn_tree_folder.gif"
- iconExpandedGroup="/images/icn_tree_folder.gif"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
- icon="/images/blank.png"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
- action="#{configurationViewer.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
-
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
-
- <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
-
- <h:commandLink action="#{configurationViewer.download}" value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- </h:commandLink>
-
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
- </h:panelGrid>
-
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
- value="#{selectedRawUIBean.contents}"
- readonly="true"/>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
-
-</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml
deleted file mode 100644
index 6e87674..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:onc="http://jboss.org/on/component">
-
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <onc:config
- configurationDefinition="#{resourceConfigurationDefinition}"
- configuration="#{resourceConfiguration}"
- readOnly="true"
- nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
- nullConfigurationMessage="#{msg['resource.configuration.null']}"
- prevalidate="true"/>
-
-</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 5c856f9..5156852 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -61,7 +61,7 @@ THIS TEXT WILL BE REMOVED.
<rich:tabPanel switchType="ajax">
<rich:tab label="Advanced Mode">
- <ui:include src="view-raw.xhtml"/>
+ <ui:include src="raw.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -69,7 +69,7 @@ THIS TEXT WILL BE REMOVED.
<c:when test="${configurationViewer.structuredSupported}">
<rich:tabPanel switchType="ajax">
<rich:tab label="Basic Mode">
- <ui:include src="view-structured.xhtml"/>
+ <ui:include src="structured.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -84,7 +84,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
limitToList="true"
reRender="upperEditButton,lowerEditButton">
- <ui:include src="view-structured.xhtml"/>
+ <ui:include src="structured.xhtml"/>
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
@@ -92,7 +92,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
limitToList="true"
reRender="upperEditButton,lowerEditButton">
- <ui:include src="view-raw.xhtml"/>
+ <ui:include src="raw.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
commit 0faf5be2c5879240f2a8acdf0b325fc45dabee34
Author: John Sanda <john(a)localhost.localdomain>
Date: Sat Feb 6 16:44:55 2010 -0500
Replacing xhtml code inside raw tab for structured and raw with an include of view-raw.xhtml
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 06557da..5c856f9 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -92,63 +92,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
limitToList="true"
reRender="upperEditButton,lowerEditButton">
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
- columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="/images/icn_tree_folder.gif"
- iconExpandedGroup="/images/icn_tree_folder.gif">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{selectedRawUIBean.path}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
- icon="/images/blank.png"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
- action="#{configurationViewer.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
-
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
-
- <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
-
- <h:commandLink action="#{configurationViewer.download}" value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- </h:commandLink>
-
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
- </h:panelGrid>
-
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
- value="#{selectedRawUIBean.contents}"
- readonly="true"/>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
+ <ui:include src="view-raw.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
commit 9cbb2abb823356a4e757470a14533615ea20d170
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 17:25:20 2010 +0100
Return failing email addresses to the caller.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
index 84a7385..618cbd7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerBean.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.core;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -29,6 +30,7 @@ import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
+import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
@@ -88,12 +90,28 @@ public class EmailManagerBean implements EmailManagerLocal {
@Resource(mappedName = "java:/Mail")
private Session mailSession;
- public void sendEmail(Collection<String> toAddresses, String messageSubject, String messageBody) throws Exception {
+ /**
+ * Send email to the addressses passed in toAddresses with the passed subject and body. Invalid emails will
+ * be reported back. This can only catch sender errors up to the first smtp gateway.
+ * @param toAddresses list of email addresses to send to
+ * @param messageSubject subject of the email sent
+ * @param messageBody body of the email to be sent
+ *
+ * @return list of email receivers for which initial delivery failed.
+ */
+ public Collection<String> sendEmail(Collection<String> toAddresses, String messageSubject, String messageBody) {
+
MimeMessage mimeMessage = new MimeMessage(mailSession);
- mimeMessage.setSubject(messageSubject);
- mimeMessage.setContent(messageBody, "text/plain");
+ try {
+ mimeMessage.setSubject(messageSubject);
+ mimeMessage.setContent(messageBody, "text/plain");
+ } catch (MessagingException e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ return toAddresses;
+ }
Exception error = null;
+ Collection<String> badAdresses = new ArrayList<String>(toAddresses.size());
// Send to each recipient individually, do not throw exceptions until we try them all
for (String toAddress : toAddresses) {
@@ -103,6 +121,7 @@ public class EmailManagerBean implements EmailManagerLocal {
Transport.send(mimeMessage, new InternetAddress[] { recipient });
} catch (Exception e) {
LOG.error("Failed to send email [" + messageSubject + "] to recipient [" + toAddress + "]", e);
+ badAdresses.add(toAddress);
// Remember the first error - in case its due to a session initialization problem,
// we don't want to lose the first error.
@@ -113,10 +132,10 @@ public class EmailManagerBean implements EmailManagerLocal {
}
if (error != null) {
- throw error;
+ LOG.error("Sending of emails failed for this reason: " + error.getMessage());
}
- return;
+ return badAdresses;
}
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@@ -166,7 +185,7 @@ public class EmailManagerBean implements EmailManagerLocal {
/*
* if we don't escape the regex special characters '\' and '$', they will be interpreted differently
* than desired; quoteReplacement was specifically written to help alleviate this common scenario:
- *
+ *
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6523151
*/
private String cleanse(String passedValue, String defaultValue) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerLocal.java
index 2b4ae5a..9535cf9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/EmailManagerLocal.java
@@ -30,19 +30,15 @@ import javax.ejb.Local;
@Local
public interface EmailManagerLocal {
/**
- * Sends an email message to the given a set of email addresses where the subject and body of the message are passed
- * in. The message body is considered to have a MIME type of <code>text/plain</code>.
+ * Send email to the addressses passed in toAddresses with the passed subject and body. Invalid emails will
+ * be reported back. This can only catch sender errors up to the first smtp gateway.
+ * @param toAddresses list of email addresses to send to
+ * @param messageSubject subject of the email sent
+ * @param messageBody body of the email to be sent
*
- * <p>This method will attempt to send to all addresses, even if one or more failed. The first exception that is
- * encountered will be the one that is eventually thrown.</p>
- *
- * @param toAddresses
- * @param messageSubject
- * @param messageBody
- *
- * @throws Exception if failed to send to one or more email addresses
+ * @return list of email receivers for which initial delivery failed.
*/
- void sendEmail(Collection<String> toAddresses, String messageSubject, String messageBody) throws Exception;
+ Collection<String> sendEmail(Collection<String> toAddresses, String messageSubject, String messageBody);
/**
* This returns an email message based on the alert email template with its replacement tokens replaced with the
commit c24829827c826fa5115ecde977cd08389db2622b
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 11:23:02 2010 +0100
Enable SMS sender plugin in build
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 5c35d56..25be782 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -46,6 +46,7 @@
<module>alert-microblog</module>
<module>alert-roles</module>
<module>alert-scriptlang</module>
+ <module>alert-sms</module>
<module>alert-snmp</module>
<module>alert-subject</module>
<module>cobbler</module>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index fd3a3f2..623c3b3 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -49,6 +49,7 @@
<pathelement location="../alert-mobicents/target/alert-mobicents-${project.version}.jar" />
<pathelement location="../alert-roles/target/alert-roles-${project.version}.jar" />
<pathelement location="../alert-scriptlang/target/alert-scriptlang-${project.version}.jar" />
+ <pathelement location="../alert-sms/target/alert-sms-${project.version}.jar" />
<pathelement location="../alert-snmp/target/alert-snmp-${project.version}.jar" />
<pathelement location="../alert-subject/target/alert-subject-${project.version}.jar" />
<pathelement location="../cobbler/target/cobbler-${project.version}.jar" />
commit 7ef341ddbfc4c0f855d01549cfd9adcddb0fc38f
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 11:17:06 2010 +0100
Add to the script lang sender for its classloading
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
new file mode 100644
index 0000000..c8e30e5
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-scriptlang/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
@@ -0,0 +1 @@
+org.jruby.embed.jsr223.JRubyEngineFactory
commit b659338ad31cac5a16eec39c264b1ca444f42e96
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 11:15:08 2010 +0100
Show acknowledgement data on the fired alerts detail page
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
index c9af102..6c707b3 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertProperties.jsp
@@ -39,6 +39,26 @@
<td class="BlockLabel"><fmt:message key="alert.current.detail.props.AlertDate"/></td>
<td class="BlockContent" colspan="2"><hq:dateFormatter time="false" value="${alert.ctime}"/></td>
</tr>
+ <tr valign="top">
+ <td class="BlockLabel">Acknowledged by:</td>
+ <td class="BlockContent">
+ <c:if test="${not empty alert.ackBy}">
+ <c:out value="${alert.ackBy.firstName}"/>
+ <c:out value=" "/>
+ <c:out value="${alert.ackBy.lastName}"/>
+ <c:out value=" ("/>
+ <c:out value="${alert.ackBy.name}"/>
+ <c:out value=")"/>
+ </c:if>
+ </td>
+ <td class="BlockLabel">Acknowledged at:</td>
+ <td class="BlockContent">
+ <c:if test="${alert.ackTime > 0}">
+ <hq:dateFormatter time="false" value="${alert.ackTime}"/>
+ </c:if>
+
+ </td>
+ </tr>
<tr>
<td colspan="5" class="BlockContent"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
</tr>
commit 9d3b20faebff1284eaab18a5823e50d8fca0e9df
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 10:52:17 2010 +0100
Remove some more outdated stuff
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
index 30aa03a..633855a 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/ViewAlertNotifications.jsp
@@ -10,16 +10,5 @@
<!-- Notification Content -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tiles:insert definition=".events.alert.view.notifications.roles"/>
- <tr>
- <td colspan="2" class="BlockBottomLine"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
- <tiles:insert definition=".events.alert.view.notifications.users"/>
- <tr>
- <td colspan="2" class="BlockBottomLine"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
- <tiles:insert definition=".events.alert.view.notifications.others"/>
- <tr>
- <td colspan="2" class="BlockBottomLine"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
+ Details of fired alerts go here
</table>
commit f0b165e09b55b0f8781e14fdacecb8d40e0d32c6
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 10:43:47 2010 +0100
Implement acknowledging of fired alerts.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
index d99124c..0b6023a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/ListAlertHistoryUIBean.java
@@ -170,6 +170,28 @@ public class ListAlertHistoryUIBean extends PagedDataTableUIBean {
return "success";
}
+ public String acknowledgeSelectedAlerts() {
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ Resource resource = EnterpriseFacesContextUtility.getResource();
+
+ String[] selectedAlerts = getSelectedAlerts();
+ Integer[] alertIds = StringUtility.getIntegerArray(selectedAlerts);
+
+ try {
+ int num = alertManager.acknowledgeAlerts(subject,resource.getId(),alertIds);
+ if (num==-1)
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,"No Alerts passed to ack");
+ else
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO,"Acknowledged " + num + " alerts");
+ } catch (Exception e) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Failed to acknowledge selected alerts.", e);
+ }
+
+ return "success";
+
+ }
+
public String purgeAllAlerts() {
Subject subject = EnterpriseFacesContextUtility.getSubject();
Resource resource = EnterpriseFacesContextUtility.getResource();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
index 05bc6cf..946f196 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/listAlertHistory.xhtml
@@ -19,12 +19,12 @@
<ui:param name="pageTitle" value="List Fired Alerts for Resource '#{ResourceUIBean.name}'"/>
<ui:param name="selectedTabName" value="Alert.History"/>
-
+
<ui:define name="content">
-
+
<h:form id="alertHistoryForm">
<input type="hidden" name="id" value="${param.id}"/>
-
+
<rich:panel styleClass="BlockContent">
<f:facet name="header">
<h:outputText value="Alerts"/>
@@ -34,7 +34,7 @@
<h:outputLabel for="alertDefinitionFilter" value="Alert Definition Filter: " />
<h:selectOneMenu id="alertDefinitionFilter" value="#{ListAlertHistoryUIBean.alertDefinitionFilter}"
style="width: 300px;">
- <a4j:support event="onchange"
+ <a4j:support event="onchange"
reRender="alertHistoryDataTable, alertHistoryDataTableScroller, dateErrors"
actionListener="#{ListAlertHistoryUIBean.clearDataModel}"
status="commonStatus" />
@@ -47,7 +47,7 @@
<h:outputLabel for="alertPriorityFilter" value="Alert Priority Filter: " />
<h:selectOneMenu id="alertPriorityFilter" value="#{ListAlertHistoryUIBean.alertPriorityFilter}"
style="width: 300px;">
- <a4j:support event="onchange"
+ <a4j:support event="onchange"
reRender="alertHistoryDataTable, alertHistoryDataTableScroller, dateErrors"
actionListener="#{ListAlertHistoryUIBean.clearDataModel}"
status="commonStatus" />
@@ -61,10 +61,10 @@
<h:inputText id="dateFilter" value="#{ListAlertHistoryUIBean.dateFilter}"
onkeypress="return ignoreEnterKey(event);"
style="width: 300px;" />
- <a4j:commandButton value="GO"
+ <a4j:commandButton value="GO"
reRender="alertHistoryDataTable, alertHistoryDataTableScroller, dateErrors"
actionListener="#{ListAlertHistoryUIBean.clearDataModel}"
- status="commonStatus"
+ status="commonStatus"
styleClass="buttonmed">
<s:defaultAction />
</a4j:commandButton>
@@ -81,7 +81,7 @@
value="#{alertHistoryDataModel}"
var="item"
width="100%"
- columnsWidth="1%, 20%, 20%, 20%, 30%, 9%"
+ columnsWidth="1%, 15%, 20%, 20%, 20%, 7%, 8%, 9%"
styleClass="resources-table"
headerClass="tableRowHeader"
footerClass="on-pager-footer"
@@ -91,25 +91,25 @@
<f:facet name="PageControlView">
<onc:paginationControl id="AlertHistoryList" />
</f:facet>
-
+
<rich:column>
<f:facet name="header">
<onc:allSelect target="selectedAlerts" />
</f:facet>
-
+
<onc:select name="selectedAlerts" value="#{item.alert.id}" />
</rich:column>
-
+
<rich:column rendered="#{param.debug}">
<f:facet name="header">
<onc:sortableColumnHeader sort="a.id">
<h:outputText styleClass="headerText" value="ID" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputText value="#{item.alert.id}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.alertDefinition.priority">
@@ -123,14 +123,14 @@
<h:outputText value="#{item.alert.alertDefinition.priority.name}"/>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.ctime">
<h:outputText styleClass="headerText" value="Date Created" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputLink value="/alerts/Alerts.do">
<f:param name="mode" value="viewAlert" />
<f:param name="id" value="#{Resource.id}" />
@@ -140,14 +140,14 @@
</h:outputText>
</h:outputLink>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<onc:sortableColumnHeader sort="a.alertDefinition.name">
<h:outputText styleClass="headerText" value="Alert Definition" />
</onc:sortableColumnHeader>
</f:facet>
-
+
<h:outputLink value="/alerts/Config.do">
<f:param name="mode" value="viewRoles"/>
<f:param name="id" value="#{Resource.id}"/>
@@ -155,21 +155,37 @@
<h:outputText value="#{item.alert.alertDefinition.name}" />
</h:outputLink>
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Alert Condition" />
</f:facet>
<h:outputText value="#{item.conditionText}" />
</rich:column>
-
+
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Actual Value" />
</f:facet>
<h:outputText value="#{item.conditionValue}" />
</rich:column>
-
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Ack by" />
+ </f:facet>
+ <h:outputText value="#{item.alert.ackBy.name}" title="#{item.alert.ackBy.firstName} #{item.alert.ackBy.lastName}"/>
+ </rich:column>
+
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText styleClass="headerText" value="Ack date" />
+ </f:facet>
+ <h:outputText value="#{item.alert.ackTime}">
+ <f:converter converterId="RelativeDurationConverter" />
+ </h:outputText>
+ </rich:column>
+
<rich:column>
<f:facet name="header">
<h:outputText styleClass="headerText" value="Recovery Info" />
@@ -186,6 +202,11 @@
<h:commandButton action="#{ListAlertHistoryUIBean.purgeAllAlerts}"
value="PURGE ALL" styleClass="on-pager-button buttonsmall"
rendered="#{ResourceUIBean.permissions.alert}" />
+ <onc:selectCommandButton action="#{ListAlertHistoryUIBean.acknowledgeSelectedAlerts}"
+ value="ACKNOWLEDGE SELECTED" target="selectedAlerts" styleClass="on-pager-button buttonsmall"
+ rendered="#{ResourceUIBean.permissions.alert}" />
+
+
<ui:param name="paginationDataTableName" value="alertHistoryDataTable"/>
<ui:param name="paginationDataModel" value="#{alertHistoryDataModel}"/>
@@ -196,9 +217,9 @@
</f:facet>
</rich:dataTable>
-
+
</h:panelGrid>
-
+
<a4j:keepAlive beanName="ListAlertHistoryUIBean"/>
</rich:panel>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 61aa96a..599d4f3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -551,6 +551,33 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
alert.setAckTime(System.currentTimeMillis());
}
+ /**
+ * Acknowledge the alerts (that got fired) so that admins know who is working
+ * on fixing the situation.
+ * @param user calling user
+ * @param resourceId resource the alerts happened on
+ * @param alertIds PKs of the alerts to ack
+ */
+ public int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds) {
+ if (!authorizationManager.hasResourcePermission(user, Permission.MANAGE_ALERTS, resourceId)) {
+ throw new PermissionException("User [" + user.getName() + "] does not have permissions to acknowledge alerts "
+ + "for resourceId=" + resourceId);
+ }
+
+ int i=0;
+ if (alertIds==null || alertIds.length==0) {
+ log.debug("acknowledgeAlerts: no alertIds passed");
+ return -1;
+ }
+
+ for (int id : alertIds) {
+ acknowledgeAlert(id,user);
+ i++;
+ if (i %20 == 0)
+ entityManager.flush();
+ }
+ return i;
+ }
public void fireAlert(int alertDefinitionId) {
log.debug("Firing an alert for alertDefinition with id=" + alertDefinitionId + "...");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
index efdf723..a148bf9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java
@@ -116,4 +116,13 @@ public interface AlertManagerLocal {
PageList<Alert> findAlertsByCriteria(Subject subject, AlertCriteria criteria);
String prettyPrintAlertURL(Alert alert);
+
+ /**
+ * Acknowledge the alerts (that got fired) so that admins know who is working
+ * on fixing the situation.
+ * @param user calling user
+ * @param resourceId resource the alerts happened on
+ * @param alertIds PKs of the alerts to ack
+ */
+ int acknowledgeAlerts(Subject user, int resourceId, Integer[] alertIds);
}
\ No newline at end of file
commit 4df3fa68e14061e1e6e2d3cc68224e32de35499d
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 10:42:56 2010 +0100
Default ackTime is -1 meaning "never"
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
index 9f0f76a..6b93414 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/Alert.java
@@ -253,7 +253,7 @@ public class Alert implements Serializable {
@Column(name ="ACK_TIME")
- private long ackTime;
+ private long ackTime = -1;
@JoinColumn(name = "ACK_BY_ID", referencedColumnName = "ID")
@ManyToOne
commit a5b5e88a0d7dbfa9b8a2fc95bc395f57977768cb
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 10:42:29 2010 +0100
If the value is -1 return an empty string as "never"
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
index 6ab477e..f137605 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
@@ -27,6 +27,9 @@ import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
/**
+ * Convert the passed value in to a relative date compared to now.
+ * If the passed value is -1, the output will be empty (as a value of 0
+ * returns the number of days since the epoch)
* @author Joseph Marques
*/
public class RelativeDurationConverter implements Converter {
@@ -34,8 +37,9 @@ public class RelativeDurationConverter implements Converter {
private static final long MILLIS_IN_SECOND = 1000L;
private static final long MILLIS_IN_MINUTE = 60 * MILLIS_IN_SECOND;
private static final long MILLIS_IN_HOUR = 60 * MILLIS_IN_MINUTE;
- private static final long MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR;
+ private static final long NEVER = -1;
+ private static final long MILLIS_IN_DAY = 24 * MILLIS_IN_HOUR;
private static final SimpleDateFormat dayFormatter = new SimpleDateFormat("D");
private static final SimpleDateFormat formatter = new SimpleDateFormat("hh:mm aaa z");
public static TimeZone tz = null;
@@ -60,6 +64,9 @@ public class RelativeDurationConverter implements Converter {
+ " converter does not support rendering objects of type " + value.getClass().getSimpleName());
}
+ if (millis== NEVER)
+ return "";
+
String result = format(millis);
return result;
}
commit 06b80339d5614e2b158621fc71239a0a33d1038b
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Feb 5 10:12:31 2010 +0100
Replace string concatentation in StringBuilder.append() to multiple append()
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
index d2c7dfb..6ab477e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/common/time/converter/RelativeDurationConverter.java
@@ -98,7 +98,7 @@ public class RelativeDurationConverter implements Converter {
timeAgo %= MILLIS_IN_DAY;
if (days > 0) {
count++;
- buf.append(days + " day");
+ buf.append(days).append(" day");
if (days != 1)
buf.append("s");
}
@@ -109,7 +109,7 @@ public class RelativeDurationConverter implements Converter {
count++;
if (buf.length() > 0)
buf.append(", ");
- buf.append(hours + " hour");
+ buf.append(hours).append(" hour");
if (hours != 1)
buf.append("s");
}
@@ -120,7 +120,7 @@ public class RelativeDurationConverter implements Converter {
if (mins > 0) {
if (buf.length() > 0)
buf.append(", ");
- buf.append(mins + " minute");
+ buf.append(mins).append(" minute");
if (mins != 1)
buf.append("s");
}
commit 553635a899e77255393360709a03eb389055c523
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 4 15:49:35 2010 -0500
Updating logic for modal editor so that its contents do not overwrite the contents of the main text area on partial page updates
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 01ed170..f120da2 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -53,6 +53,8 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
private Set<String> modifiedFiles = new HashSet<String>();
+ private String modalEditorContents;
+
@RequestParameter
private String tab;
@@ -215,6 +217,10 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
}
public void setModalEditorContents(String contents) {
- selectedRawUIBean.setContents(contents);
+ modalEditorContents = contents;
+ }
+
+ public void applyModalEditContents() {
+ selectedRawUIBean.setContents(modalEditorContents);
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index ddcb0db..f3c7406 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -46,6 +46,7 @@
<h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
<h:panelGroup style="text-align:right">
<a4j:commandButton value="Save"
+ action="#{configurationEditor.applyModalEditContents}"
rendered="#{!readOnly}"
reRender="fileContents,fileMenu,lowerChangedFilesLabel,upperChangedFilesLabel"
styleClass="buttonmed"
commit 93cbcaa11f0ca2688b07c7fdd0d5d31a108e8f3c
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 4 15:08:44 2010 -0500
Refactoring some duplicate code in xhtml files and changing event to use for file menu selection
It also appears that upload is broken so I have some changes that attempt to fix it. Still
not working though. There were references in upload-modal.xhtml to
ExistingResourceConfigurationUIBean that needed to be replacced with references to
configurationEditor. I have also ported the upload related methods to ResourceConfigurationEditor.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 72c02e9..0679d0f 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -73,7 +73,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
// @Out
private Collection<RawConfigDirectory> rawConfigDirectories;
- @Out
+// @Out
private FileUploadUIBean fileUploader = new FileUploadUIBean();
private String modalEditorContents;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index d16405e..01ed170 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -23,9 +23,11 @@
package org.rhq.enterprise.gui.configuration.resource;
+import org.apache.commons.io.FileUtils;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
@@ -33,10 +35,13 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.model.UploadItem;
import javax.faces.application.FacesMessage;
+import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
@@ -51,6 +56,9 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
@RequestParameter
private String tab;
+ @Out
+ private FileUploadUIBean fileUploader = new FileUploadUIBean();
+
@Override
protected void doInitialization() {
if (tab != null) {
@@ -135,6 +143,28 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
return modifiedFiles.size() + " files changed in this configuration";
}
+ public boolean isFileUploadAvailable() {
+ return isRawSupported() || (isStructuredAndRawSupported() && isRawMode());
+ }
+
+ public String completeUpload() {
+ try {
+ if (fileUploader.getFileItem() != null) {
+ UploadItem fileItem = fileUploader.getFileItem();
+ if (fileItem.isTempFile()) {
+ selectedRawUIBean.setContents(FileUtils.readFileToString(fileItem.getFile()));
+ } else {
+ selectedRawUIBean.setContents(new String(fileItem.getData()));
+ }
+ fileUploader.clear();
+ }
+
+ return null;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
public String updateConfiguration() {
ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 8a6aa68..a9c4f89 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -95,7 +95,7 @@ THIS TEXT WILL BE REMOVED.
icon="#{rawConfigUIBean.icon}">
<h:panelGroup>
<h:outputLabel value="#{rawConfigUIBean.fileName}">
- <a4j:support event="onclick"
+ <a4j:support event="onmousedown"
onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
action="#{configurationEditor.select(rawConfigUIBean.path)}"
@@ -248,7 +248,7 @@ THIS TEXT WILL BE REMOVED.
icon="#{rawConfigUIBean.icon}">
<h:panelGroup>
<h:outputLabel value="#{rawConfigUIBean.fileName}">
- <a4j:support event="onclick"
+ <a4j:support event="onmousedown"
onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
action="#{configurationEditor.select(rawConfigUIBean.path)}"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
index 7c22818..274a6dd 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload-modal.xhtml
@@ -8,19 +8,21 @@
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
- <f:subview id="uploadSubview" rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
+ <f:subview id="uploadSubview" rendered="#{configurationEditor.fileUploadAvailable}">
<script type="text/javascript">
function prepareFormForUpload() {
var form = document.getElementById('editResourceConfigurationForm');
form.encoding = 'multipart/form-data';
+
+ return true;
}
</script>
<rich:modalPanel id="uploadWindow" width="800" height="400">
<f:facet name="header">
<h:panelGroup>
- <h:outputText value="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ <h:outputText value="#{selectedRawUIBean.path}"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
@@ -31,7 +33,7 @@
</f:facet>
- <rich:panel id="uploadPanel" rendered="#{ExistingResourceConfigurationUIBean.fileUploadAvailable}">
+ <rich:panel id="uploadPanel">
<input type="hidden" name="currentResourceId" value="#{ResourceUIBean.id}"/>
@@ -39,12 +41,13 @@
listHeight="50px"
fileUploadListener="#{fileUploader.fileUploadListener}"
addControlLabel="Browse"
- immediateUpload="false">
+ immediateUpload="false"
+ onupload="prepareFormForUpload()">
<f:facet name="label">
<h:outputText value="{_KB}KB from {KB}KB uploaded --- {mm}:{ss}"/>
</f:facet>
<a4j:support event="onuploadcomplete"
- action="#{ExistingResourceConfigurationUIBean.completeUpload}"
+ action="#{configurationEditor.completeUpload}"
reRender="fileUpload,fileContents,fileMenu"
onsubmit="#{rich:component('uploadWindow')}.hide()"/>
</rich:fileUpload>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
new file mode 100644
index 0000000..0a105a2
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:onc="http://jboss.org/on/component">
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <h:panelGrid columns="2"
+ styleClass="raw-outer-table"
+ columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
+ <rich:panel style="width:100%">
+ <f:facet name="header">Files</f:facet>
+ <rich:panelMenu mode="ajax"
+ expandMode="client"
+ iconCollapsedGroup="/images/icn_tree_folder.gif"
+ iconExpandedGroup="/images/icn_tree_folder.gif"
+ limitToList="true"
+ reRender="fileContents">
+ <c:forEach items="#{rawConfigDirectories}"
+ var="rawConfigDir">
+ <rich:panelMenuGroup label="#{rawConfigDir.path}"
+ expanded="true"
+ selectedChild="#{currentPath}">
+ <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
+ <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
+ icon="/images/blank.png"
+ onclick="cursor_wait();"
+ oncomplete="cursor_clear();"
+ action="#{configurationViewer.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor"/>
+ </c:forEach>
+ </rich:panelMenuGroup>
+ </c:forEach>
+ </rich:panelMenu>
+ </rich:panel>
+
+ <h:panelGrid columns="1" style="width:100%;">
+ <h:panelGrid columns="4" style="width:100%;">
+ <h:outputLabel value=" "/>
+
+ <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
+
+ <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
+
+ <h:commandLink action="#{configurationViewer.download}" value="Download">
+ <h:graphicImage value="/images/download.png"/>
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ </h:commandLink>
+
+ <a4j:status id="selectedFileHeader"
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
+ </h:panelGrid>
+
+ <rich:panel style="margin-left:1px; border: none;">
+ <h:inputTextarea id="fileContents"
+ style="width:100%"
+ value="#{selectedRawUIBean.contents}"
+ readonly="true"/>
+ </rich:panel>
+ </h:panelGrid>
+ </h:panelGrid>
+
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index c090db9..06557da 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -60,66 +60,8 @@ THIS TEXT WILL BE REMOVED.
<c:when test="${configurationViewer.rawSupported}">
<rich:tabPanel switchType="ajax">
- <rich:tab label="Advanced Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <h:panelGrid columns="2"
- styleClass="raw-outer-table"
- columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
- <rich:panel style="width:100%">
- <f:facet name="header">Files</f:facet>
- <rich:panelMenu mode="ajax"
- expandMode="client"
- iconCollapsedGroup="/images/icn_tree_folder.gif"
- iconExpandedGroup="/images/icn_tree_folder.gif"
- limitToList="true"
- reRender="fileContents">
- <c:forEach items="#{rawConfigDirectories}"
- var="rawConfigDir">
- <rich:panelMenuGroup label="#{rawConfigDir.path}"
- expanded="true"
- selectedChild="#{currentPath}">
- <c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
- icon="/images/blank.png"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
- action="#{configurationViewer.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor"/>
- </c:forEach>
- </rich:panelMenuGroup>
- </c:forEach>
- </rich:panelMenu>
- </rich:panel>
-
- <h:panelGrid columns="1" style="width:100%;">
- <h:panelGrid columns="4" style="width:100%;">
- <h:outputLabel value=" "/>
-
- <h:outputLink value="#" onclick="#{rich:component('modalEditor')}.show()">View Full Screen</h:outputLink>
-
- <h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
-
- <h:commandLink action="#{configurationViewer.download}" value="Download">
- <h:graphicImage value="/images/download.png"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- </h:commandLink>
-
- <a4j:status id="selectedFileHeader"
- startText="Loading #{selectedRawUIBean.path} ..."
- stopText="#{selectedRawUIBean.path}"/>
- </h:panelGrid>
-
- <rich:panel style="margin-left:1px; border: none;">
- <h:inputTextarea id="fileContents"
- style="width:100%"
- value="#{selectedRawUIBean.contents}"
- readonly="true"/>
- </rich:panel>
- </h:panelGrid>
- </h:panelGrid>
+ <rich:tab label="Advanced Mode">
+ <ui:include src="view-raw.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
commit 2df8a8b15c48e90d075d6431d6badcd0490ec4bb
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 4 17:01:09 2010 +0100
Small cosmetic changes.
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
index 318e5a1..0d1e7ae 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
@@ -25,6 +25,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.jboss.seam.annotations.Create;
import org.rhq.core.domain.authz.Role;
@@ -41,16 +44,22 @@ import org.rhq.enterprise.server.util.LookupUtil;
@SuppressWarnings("unused")
public class RolesBackingBean extends CustomAlertSenderBackingBean {
+ private final Log log = LogFactory.getLog(RolesBackingBean.class);
+
private List<Role> allRoles;
private Map<String, String> rolesMap;
private List<String> currentRoles;
private List<String> rolesToRemove;
private static final String ROLE_ID = "roleId";
+ private boolean isDebug = false;
@Create
public void init() {
+ if (log.isDebugEnabled())
+ isDebug = true;
+
getAllRoles();
getSelectableRolesMap();
@@ -128,13 +137,13 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
public String addRoles() {
- System.out.println("Selected roles: " + currentRoles );
+ if (isDebug)
+ log.debug("Selected roles: " + currentRoles );
if (currentRoles.isEmpty())
return "ALERT_NOTIFICATION";
String roles="";
for (String role : currentRoles) {
- System.out.println(role);
roles += role;
roles += ",";
}
@@ -157,14 +166,14 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
}
public String removeRoles() {
- System.out.println("In remove roles, " + rolesToRemove);
+ if (isDebug)
+ log.debug("In remove roles, " + rolesToRemove);
String roles ="";
List<String> resulting = new ArrayList<String>(currentRoles);
resulting.removeAll(rolesToRemove);
for (String subject : resulting) {
- System.out.println(subject);
roles += subject;
roles += ",";
}
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index 758c731..7cb0ce0 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -51,10 +51,14 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
private List<String> currentSubjects;
private List<String> subjectsToRemove;
private static final String SUBJECT_ID = "subjectId";
+ private boolean isDebug;
@Create
public void init() {
+ if (log.isDebugEnabled())
+ isDebug = true;
+
getAllSubjects();
getSelectableSubjectsMap();
@@ -135,13 +139,13 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
public String addSubjects() {
- System.out.println("Selected subjects: " + currentSubjects);
+ if (isDebug)
+ log.debug("Selected subjects: " + currentSubjects);
if (currentSubjects.isEmpty())
return "ALERT_NOTIFICATIONS";
String subjects="";
for (String subject : currentSubjects) {
- System.out.println(subject);
subjects += subject;
subjects += ",";
}
@@ -164,14 +168,14 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
}
public String removeSubjects() {
- System.out.println("In remove subjects, " + subjectsToRemove);
+ if (isDebug)
+ log.debug("In remove subjects, " + subjectsToRemove);
String subjects="";
List<String> resulting = new ArrayList<String>(currentSubjects);
resulting.removeAll(subjectsToRemove);
for (String subject : resulting) {
- System.out.println(subject);
subjects += subject;
subjects += ",";
}
commit e226e6e261cd27016f961cf6bc2d24838c8c2930
Merge: f16247c... aebb009...
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 4 10:50:31 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit f16247c6f37506ff4152501e80b4e6c5172d263c
Author: John Sanda <john(a)localhost.localdomain>
Date: Thu Feb 4 10:49:07 2010 -0500
Moving common structured code into view-structured.xhtml
Also adding logic to only render the view in view-raw-modal.xhtml when raw is supported.
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index 82c3937..ddcb0db 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -22,7 +22,7 @@
</c:otherwise>
</c:choose>
- <f:subview id="modalEditorSubview">
+ <f:subview id="modalEditorSubview" rendered="#{editor.rawSupported or editor.structuredAndRawSupported}">
<rich:modalPanel id="modalEditor" width="800" height="600">
<f:facet name="header">
<h:panelGroup>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml
new file mode 100644
index 0000000..6e87674
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-structured.xhtml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:onc="http://jboss.org/on/component">
+
+ <h:outputText value=" #{messages.nopermissionedit}"
+ rendered="#{!ResourceUIBean.permissions.configure}"/>
+
+ <onc:config
+ configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
+ readOnly="true"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
+ prevalidate="true"/>
+
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index fd6d6e4..c090db9 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -122,22 +122,12 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
- <ui:include src="view-raw-modal.xhtml"/>
</c:when>
<c:when test="${configurationViewer.structuredSupported}">
<rich:tabPanel switchType="ajax">
- <rich:tab label="Basic Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <onc:config
- configurationDefinition="#{resourceConfigurationDefinition}"
- configuration="#{resourceConfiguration}"
- readOnly="true"
- nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
- nullConfigurationMessage="#{msg['resource.configuration.null']}"
- prevalidate="true"/>
+ <rich:tab label="Basic Mode">
+ <ui:include src="view-structured.xhtml"/>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -152,16 +142,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
limitToList="true"
reRender="upperEditButton,lowerEditButton">
- <h:outputText value=" #{messages.nopermissionedit}"
- rendered="#{!ResourceUIBean.permissions.configure}"/>
-
- <onc:config
- configurationDefinition="#{resourceConfigurationDefinition}"
- configuration="#{resourceConfiguration}"
- readOnly="true"
- nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
- nullConfigurationMessage="#{msg['resource.configuration.null']}"
- prevalidate="true"/>
+ <ui:include src="view-structured.xhtml"/>
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
@@ -228,11 +209,11 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
-
- <ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
+ <ui:include src="view-raw-modal.xhtml"/>
+
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
<s:button id="lowerEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
commit 4d5cb23d22a21caebc2e247691d97a819aee1d77
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 4 16:44:51 2010 +0100
README file for this sender.
diff --git a/modules/enterprise/server/plugins/alert-sms/README.txt b/modules/enterprise/server/plugins/alert-sms/README.txt
new file mode 100644
index 0000000..d61a25f
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/README.txt
@@ -0,0 +1,34 @@
+
+This SMS sender works with the OpenAPI from Deutsche Telekom's
+developergarden / SendSMS service.
+
+In order to use it - even for testing, you need to register
+at www.developergarden.com
+
+NOTE: There is currently an issue with the classloading of the alert senders,
+which prevents the automatic selection of some classes from the RestEasy
+package.
+To work around it, you can copy the following jars to
+jbossas/server/default/lib/
+
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+
\ No newline at end of file
commit 4ede7a93ec1da27cf1795c4c5ef7a71d98b5d89e
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 4 16:41:46 2010 +0100
Add more dependencies.
diff --git a/modules/enterprise/server/plugins/alert-sms/pom.xml b/modules/enterprise/server/plugins/alert-sms/pom.xml
index 072fa2f..901a11d 100644
--- a/modules/enterprise/server/plugins/alert-sms/pom.xml
+++ b/modules/enterprise/server/plugins/alert-sms/pom.xml
@@ -173,6 +173,16 @@
<artifactId>jaxrs-api</artifactId>
<version>${resteasy.version}</version>
</artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
</configuration>
commit 5b674bd27636a24370a363895b651286d07a1446
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 4 15:45:24 2010 +0100
If a sender fails, log the full stack trace at debug level
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 8eee581..61aa96a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -648,6 +648,8 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
}
catch (Throwable t) {
log.error("Sender failed: " + t.getMessage());
+ if (log.isDebugEnabled())
+ log.debug("Sender " + sender.toString() + "failed: \n", t);
}
}
}
commit 18035ca8681d367f26d969050a5a0eda461690a9
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Feb 4 15:03:29 2010 +0100
Alert sender that sendes via German Telekom REST interface.
diff --git a/modules/enterprise/server/plugins/alert-sms/pom.xml b/modules/enterprise/server/plugins/alert-sms/pom.xml
new file mode 100644
index 0000000..072fa2f
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/pom.xml
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>rhq-enterprise-server-plugins-parent</artifactId>
+ <groupId>org.rhq</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>alert-sms</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+
+ <name>RHQ Enterprise Server SMS-Sender Alert Plugin</name>
+
+ <scm>
+ <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</connection>
+ <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/enterprise/server/...</developerConnection>
+ </scm>
+
+ <properties>
+ <scm.module.path>modules/enterprise/server/plugins/alert-sms/</scm.module.path>
+ <resteasy.version>1.2.GA</resteasy.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope> <!-- by JBossAS -->
+ </dependency>
+
+ <!--
+ TODO: This is a fix for the Javac bug requiring annotations to be available when compiling dependent classes.
+ -->
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>hibernate-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ <scope>provided</scope>
+ <!-- needed for referenced domain entities that use Hibernate annotations -->
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${resteasy.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
+ <!--
+ <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
+ -->
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/rhq-serverplugins</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
+ </jar>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-resteasy-jars</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <version>${resteasy.version}</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java b/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java
new file mode 100644
index 0000000..83c9a86
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/java/org/rhq/enterprise/server/plugins/alertSms/SmsSender.java
@@ -0,0 +1,218 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2009 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.plugins.alertSms;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+import java.net.URI;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.apache.commons.httpclient.Credentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.resteasy.client.ClientExecutor;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientRequestFactory;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
+import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
+import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Sender class for Alerts
+ * @author Heiko W. Rupp
+ */
+public class SmsSender extends AlertSender {
+
+ private final Log log = LogFactory.getLog(SmsSender.class);
+ private long TWO_MINUTES = 1000L * 60L * 2L;
+ private static final String DEVGARDEN_SMS_GW = "https://gateway.developer.telekom.com/p3gw-mod-odg-sms/rest";
+ private static final String DEVGARDEN_SECURE_TOKEN_SERVER = "https://sts.idm.telekom.com/rest-v1/tokens/odg";
+ private static final String TOKEN_EXPIRY_TIME = "token-expiry-time";
+ private static final String TOKEN = "token";
+
+ @Override
+ public SenderResult send(Alert alert) {
+
+ String token = null;
+ try {
+ token = getToken();
+ } catch (Exception e) {
+ return new SenderResult(ResultState.FAILURE, "Can not obtain token: " + e.getMessage());
+ }
+
+ Resource res = alert.getAlertDefinition().getResource();
+ Integer alertId = alert.getId();
+
+ StringBuilder b = new StringBuilder();
+ b.append("Alert ");
+ b.append("(").append(alertId).append("): ");
+ b.append(res.getName());
+ b.append(",id=(").append(res.getId()).append(")");
+ b.append("Brought by RHQ");
+
+ try {
+ sendAlertSms(token,b.toString());
+ } catch (Exception e) {
+ return new SenderResult(ResultState.FAILURE, "Failed to send SMS: " + e.getMessage());
+ }
+
+ return new SenderResult(ResultState.SUCCESS, "SMS sent");
+ }
+
+ /**
+ * Do the actual SMS sending. For this to succeed, it needs an auth token.
+ * @param token valid access token
+ * @param message the message to send
+ */
+ private void sendAlertSms(String token, String message) throws Exception {
+
+ String mode = preferences.getSimpleValue("environment","sandbox");
+ String tel = alertParameters.getSimpleValue("tel",null);
+ if (tel==null)
+ throw new IllegalArgumentException("No telephone number given");
+
+ ClientRequest req = new ClientRequest(DEVGARDEN_SMS_GW + "/" + mode + "/sms");
+
+ String body = "number=" + tel + "&" + "message=" + message; // TODO encode?
+ req.body(MediaType.APPLICATION_FORM_URLENCODED, body);
+
+ req.header("Authorization","TAuth realm=\"https://odg.t-online.de\",tauth_token=\"" + token + "\"");
+ req.accept(MediaType.TEXT_PLAIN_TYPE);
+
+
+
+ try {
+ ClientResponse resp = req.post(String.class);
+ if (resp.getStatus()==200) {
+ System.out.println(resp.getEntity());
+ }
+ else {
+ System.out.println("Fehler " + resp.getStatus());
+ System.out.println(resp.getEntity());
+ throw new RuntimeException((String) resp.getEntity());
+ }
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ throw (e);
+ }
+
+ }
+
+ /**
+ * Get a token from the secure token server if needed. Store the token
+ * in preferences for caching purposes.
+ * @return a token if everything is ok
+ * @throws Exception if no token can be obtained.
+ */
+ private String getToken() throws Exception {
+
+ String token = preferences.getSimpleValue(TOKEN,null);
+ PropertySimple tokenTimeProp = preferences.getSimple(TOKEN_EXPIRY_TIME);
+ Long tokenExpTime = null;
+ if (tokenTimeProp!=null)
+ tokenExpTime = tokenTimeProp.getLongValue();
+
+ if (token == null || tokenExpTime == null || tokenExpTime < System.currentTimeMillis() + TWO_MINUTES ) {
+
+ String userId = preferences.getSimpleValue("login",null);
+ String password = preferences.getSimpleValue("password",null);
+
+ if (userId==null || password==null)
+ throw new IllegalArgumentException("User name or password were missing");
+
+
+ Credentials credentials = new UsernamePasswordCredentials(userId, password);
+ HttpClient httpClient = new HttpClient();
+ httpClient.getState().setCredentials(AuthScope.ANY, credentials);
+ httpClient.getParams().setAuthenticationPreemptive(true);
+
+ ClientExecutor clientExecutor = new ApacheHttpClientExecutor(httpClient);
+
+ try {
+ URI uri = new URI(DEVGARDEN_SECURE_TOKEN_SERVER);
+ ClientRequestFactory fac = new ClientRequestFactory(clientExecutor,uri);
+
+ ClientRequest request = fac.createRequest(DEVGARDEN_SECURE_TOKEN_SERVER);
+
+ request.accept(MediaType.TEXT_PLAIN_TYPE);
+ ClientResponse resp = request.get(String.class);
+
+ // TODO check status
+ System.out.println(resp.getStatus());
+ String response = (String) resp.getEntity();
+ BufferedReader reader = new BufferedReader(new StringReader(response));
+ while (reader.ready()) {
+ String line = reader.readLine();
+ if (line.startsWith("token=")) {
+ token = line.substring(6);
+ break;
+ }
+ }
+ System.out.println("Token: " + token);
+ MultivaluedMap<String, List> headers = resp.getHeaders();
+ List expiresList = headers.get("Expires");
+ String expires = (String) expiresList.get(0);
+ SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
+ Date date = df.parse(expires);
+ if (tokenTimeProp==null) {
+ tokenTimeProp=new PropertySimple(TOKEN_EXPIRY_TIME, date.getTime());
+ preferences.put(tokenTimeProp);
+ }
+ else
+ tokenTimeProp.setLongValue(date.getTime());
+
+ PropertySimple tokenProp = preferences.getSimple(TOKEN);
+ if (tokenProp ==null) {
+ tokenProp = new PropertySimple(TOKEN,token);
+ preferences.put(tokenProp);
+ }
+ else {
+ tokenProp.setStringValue(token);
+ }
+ ConfigurationManagerLocal mgr = LookupUtil.getConfigurationManager();
+ mgr.mergeConfiguration(preferences);
+
+ } catch (Exception e) {
+ e.printStackTrace(); // TODO: Customise this generated block
+ throw e;
+ }
+ }
+
+ return token;
+ }
+
+}
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml
new file mode 100644
index 0000000..cf87641
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<alert-plugin
+ name="alert-sms"
+ displayName="Alert:SMS"
+ xmlns="urn:xmlns:rhq-serverplugin.alert"
+ xmlns:c="urn:xmlns:rhq-configuration"
+ xmlns:serverplugin="urn:xmlns:rhq-serverplugin"
+ package="org.rhq.enterprise.server.plugins.alertSms"
+ description="Alert sender plugin that sends alert notifications via SMS"
+ >
+
+ <serverplugin:help>
+ This alert sender plugin is used to send notifications via SMS. Note that this
+ needs an account with www.developergraden.com. Also if you want to use the production
+ system, you need to pay per SMS sent. In the sandbox, you have 10 SMS for free per day,
+ which will include a notice about developergarden.
+ </serverplugin:help>
+
+
+ <!-- Global preferences for all sms alerts -->
+ <serverplugin:plugin-configuration>
+ <c:simple-property name="login" type="string" description="Login to the provider" required="true"/>
+ <c:simple-property name="password" type="password" description="Password for the provider" required="true"/>
+ <c:simple-property name="environment">
+ <c:property-options>
+ <c:option value="sandbox" default="true"/>
+ <c:option value="production"/>
+ </c:property-options>
+ </c:simple-property>
+
+ </serverplugin:plugin-configuration>
+
+ <short-name>SMS</short-name>
+ <plugin-class>SmsSender</plugin-class>
+
+ <alert-configuration>
+ <c:simple-property name="tel" type="string" description="Telephone number to send SMS to"/>
+ </alert-configuration>
+
+</alert-plugin>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.Providers b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.Providers
new file mode 100644
index 0000000..35ebaa0
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.Providers
@@ -0,0 +1,17 @@
+org.jboss.resteasy.plugins.providers.DataSourceProvider
+org.jboss.resteasy.plugins.providers.DefaultTextPlain
+org.jboss.resteasy.plugins.providers.StringTextStar
+org.jboss.resteasy.plugins.providers.InputStreamProvider
+org.jboss.resteasy.plugins.providers.ByteArrayProvider
+org.jboss.resteasy.plugins.providers.FormUrlEncodedProvider
+org.jboss.resteasy.plugins.providers.FileProvider
+org.jboss.resteasy.plugins.providers.StreamingOutputProvider
+org.jboss.resteasy.plugins.providers.IIOImageProvider
+org.jboss.resteasy.plugins.interceptors.CacheControlInterceptor
+org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor
+org.jboss.resteasy.plugins.interceptors.encoding.ClientContentEncodingHeaderInterceptor
+org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor
+org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor
+org.jboss.resteasy.plugins.interceptors.encoding.ServerContentEncodingHeaderInterceptor
+
+
diff --git a/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate
new file mode 100644
index 0000000..feb1541
--- /dev/null
+++ b/modules/enterprise/server/plugins/alert-sms/src/main/resources/META-INF/services/javax.ws.rs.ext.RuntimeDelegate
@@ -0,0 +1 @@
+org.jboss.resteasy.spi.ResteasyProviderFactory
\ No newline at end of file
commit aebb009238a14b1a5c242f5f811c45abaf4fe2e3
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 3 19:41:57 2010 -0500
removed option for enum value that no longer exists.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 0aca7d5..d16405e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -154,10 +154,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
return "failure";
- case UNSENT:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update was not valid",
- updateRequest.getErrorMessage());
- return "failure";
}
}
else {
commit dc1e66d7cd1c51937a054ae6200ef3c056e13bb8
Merge: 12ae18b... 705a350...
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 3 19:34:19 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 12ae18be08705343bb697bfab2e023b39dba64f5
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 3 19:34:11 2010 -0500
removing UNSENT as an option for config update status.
diff --git a/.gitk-tmp.18588/8/[3b7d6dc377c6c5e211ce8b868ccd0801f0b57a7a] ExistingResourceConfigurationUIBean.java b/.gitk-tmp.18588/8/[3b7d6dc377c6c5e211ce8b868ccd0801f0b57a7a] ExistingResourceConfigurationUIBean.java
new file mode 100644
index 0000000..150f055
--- /dev/null
+++ b/.gitk-tmp.18588/8/[3b7d6dc377c6c5e211ce8b868ccd0801f0b57a7a] ExistingResourceConfigurationUIBean.java
@@ -0,0 +1,614 @@
+/*
+ * 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.gui.configuration.resource;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Out;
+import org.jetbrains.annotations.Nullable;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
+import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+// This class is temporarily decleared in components.xml since it is declared under two names - ViewUIBean and
+// UIBean. This class is undergoing some refactoring and part of that will include declaring the @Name and @Scope
+// annotations again.
+//
+//@Name(value = "ExistingResourceConfigurationViewUIBean")
+//(a)Scope(ScopeType.PAGE)
+public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUIBean {
+ public static final String MANAGED_BEAN_NAME = "ExistingResourceConfigurationUIBean";
+
+ private static final boolean STRUCTURED_MODE = true;
+ private static final boolean RAW_MODE = false;
+
+ private boolean mode = STRUCTURED_MODE;
+
+ @Out
+ private Collection<RawConfigDirectory> rawConfigDirectories;
+
+ @Out
+ private FileUploadUIBean fileUploader = new FileUploadUIBean();
+
+ private String modalEditorContents;
+
+ private int numberOfModifiedFiles;
+
+ public ExistingResourceConfigurationUIBean() {
+ removeSessionScopedBeanIfInView("/rhq/resource/configuration/view.xhtml",
+ ExistingResourceConfigurationUIBean.class);
+ }
+
+ @Create
+ public void begin() {
+ if (isRawSupported() || isStructuredAndRawSupported()) {
+ initConfigDirectories();
+ }
+ else {
+ rawConfigDirectories = Collections.EMPTY_LIST;
+ }
+ }
+
+ private void initConfigDirectories() {
+ Map<String, RawConfigDirectory> dirs = new HashMap<String, RawConfigDirectory>();
+
+ for (RawConfiguration rawConfig : getConfiguration().getRawConfigurations()) {
+ String parentDirPath = getParentDir(rawConfig);
+ RawConfigDirectory dir = dirs.get(parentDirPath);
+
+ if (dir == null) {
+ dir = new RawConfigDirectory();
+ dir.setPath(parentDirPath);
+ }
+
+ dir.addRawConfig(rawConfig);
+ dirs.put(parentDirPath, dir);
+ }
+
+ rawConfigDirectories = dirs.values();
+ }
+
+ private String getParentDir(RawConfiguration rawConfig) {
+ File file = new File(rawConfig.getPath());
+ return file.getParentFile().getAbsolutePath();
+ }
+
+ public String editConfiguration() {
+ mode = STRUCTURED_MODE;
+ return SUCCESS_OUTCOME;
+ }
+
+ public String editRawConfiguration() {
+ mode = RAW_MODE;
+ return SUCCESS_OUTCOME;
+ }
+
+ public void changeTabs(ValueChangeEvent event) {
+ if (event.getNewValue().equals("rawTab")) {
+ switchToRaw();
+ mode = RAW_MODE;
+ }
+ else if (event.getNewValue().equals("structuredTab")) {
+ switchToStructured();
+ mode = STRUCTURED_MODE;
+ }
+ }
+
+ public String switchToRaw() {
+ Configuration configuration = LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(), getConfiguration(), true);
+
+ setConfiguration(configuration);
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ }
+ current = null;
+ setConfiguration(configuration);
+ updateModifiedCache();
+ mode = RAW_MODE;
+ return null;
+ }
+
+ private void updateModifiedCache() {
+ Configuration configuration = getConfiguration();
+
+ for (RawConfiguration updatedRaw : configuration.getRawConfigurations()) {
+ RawConfiguration cachedRaw = modified.get(updatedRaw.getPath());
+ if (cachedRaw != null && !updatedRaw.getSha256().equals(cachedRaw.getSha256())) {
+ modified.remove(cachedRaw.getPath());
+ }
+ }
+ }
+
+ public String switchToStructured() {
+ Configuration configuration = LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(), getMergedConfiguration(), false);
+
+ for (Property property : configuration.getAllProperties().values()) {
+ property.setConfiguration(configuration);
+ }
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ setConfiguration(configuration);
+ }
+ current = null;
+ setConfiguration(configuration);
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ System.out.println(raw.getPath() + " -\n" + (new String(raw.getContents())) + "\n");
+ }
+
+ updateModifiedCache();
+
+ mode = STRUCTURED_MODE;
+
+ return null;
+ }
+
+ public String updateConfiguration() {
+ return updateConfiguration(true);
+
+ }
+
+ public String updateRawConfiguration() {
+ return updateConfiguration(false);
+ }
+
+ public void saveModalEditorContents() {
+ setCurrentContents(modalEditorContents);
+ }
+
+ public String updateConfiguration(boolean fromStructured) {
+
+ ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition());
+ int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+
+ AbstractResourceConfigurationUpdate updateRequest =
+ this.configurationManager.updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(),
+ resourceId, getMergedConfiguration(), fromStructured);
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ case UNSENT:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update was not valid"
+ , updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ }
+ } else {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
+ + "no update request has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ }
+ return null;
+ }
+
+ public String finishAddMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
+ return SUCCESS_OUTCOME;
+ }
+
+ public String finishEditMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map updated.");
+ return SUCCESS_OUTCOME;
+ }
+
+ protected int getConfigurationDefinitionKey() {
+ return EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+ }
+
+ @Nullable
+ protected ConfigurationDefinition lookupConfigurationDefinition() {
+ int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+ ConfigurationDefinition configurationDefinition = this.configurationManager
+ .getResourceConfigurationDefinitionForResourceType(EnterpriseFacesContextUtility.getSubject(),
+ resourceTypeId);
+ return configurationDefinition;
+ }
+
+ protected int getConfigurationKey() {
+ return EnterpriseFacesContextUtility.getResource().getId();
+ }
+
+ protected ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ @Nullable
+ protected Configuration lookupConfiguration() {
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+ AbstractResourceConfigurationUpdate configurationUpdate = this.configurationManager
+ .getLatestResourceConfigurationUpdate(subject, resourceId);
+ Configuration configuration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+ if (configuration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration, getConfigurationDefinition());
+ }
+
+ return configuration;
+ }
+
+ private final Log log = LogFactory.getLog(AbstractConfigurationUIBean.class);
+ private Integer resourceId = null;
+
+ private static final long serialVersionUID = 4837157548556168146L;
+
+ public String commit() {
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ LookupUtil.getConfigurationManager().updateResourceConfiguration(subject, getResourceId(),
+ getMergedConfiguration());
+
+ return "/rhq/resource/configuration/view.xhtml?id=" + getResourceId();
+ }
+
+ private Configuration getMergedConfiguration() {
+ for (RawConfiguration raw : getModified().values()) {
+ getRaws().put(raw.getPath(), raw);
+ log.error("Just merged in raw path =[" + raw.getPath() + "]");
+ log.error(" file =[" + new String(raw.getContents()) + "]");
+
+ }
+ getConfiguration().getRawConfigurations().clear();
+ getConfiguration().getRawConfigurations().addAll(getRaws().values());
+ return getConfiguration();
+ }
+
+ public String editCurrent() {
+ RawConfiguration editedRaw = getCurrent();
+ RawConfiguration originalRaw = raws.get(editedRaw.getPath());
+
+ if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
+ --numberOfModifiedFiles;
+ RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
+ rawUIBean.setModified(false);
+ getModified().remove(editedRaw.getPath());
+ }
+ else {
+ ++numberOfModifiedFiles;
+ }
+ return null;
+ }
+
+ public void undoEdit(String path) {
+ modified.remove(path);
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
+
+ if (bean != null) {
+ bean.setModified(false);
+ bean.setIcon("/images/blank.png");
+ }
+
+ }
+
+ public int getConfigId() {
+ return getConfiguration().getId();
+ }
+
+ private ConfigurationFormat getConfigurationFormat() {
+ return getConfigurationDefinition().getConfigurationFormat();
+ }
+
+ public RawConfiguration getCurrent() {
+ if (null == current) {
+ Iterator<RawConfiguration> iterator = getRaws().values().iterator();
+ if (iterator.hasNext()) {
+ current = iterator.next();
+ } else {
+ current = new RawConfiguration();
+ current.setPath("/dev/null");
+ current.setContents("");
+ }
+ }
+ return current;
+ }
+
+ public String getCurrentContents() {
+ return new String(getCurrent().getContents());
+ }
+
+ public String getCurrentPath() {
+ return getCurrent().getPath();
+ }
+
+ public String getModalEditorHeader() {
+ return getCurrentPath();
+ }
+
+ public String getModalEditorContents() {
+ if (modalEditorContents == null) {
+ modalEditorContents = getCurrentContents();
+ }
+ return modalEditorContents;
+ }
+
+ public void setModalEditorContents(String contents) {
+ modalEditorContents = contents;
+ }
+
+ public TreeMap<String, RawConfiguration> getModified() {
+ if (modified == null) {
+ modified = new TreeMap<String, RawConfiguration>();
+ }
+ return modified;
+ }
+
+ public String getSelectedTab() {
+ if (mode == STRUCTURED_MODE) {
+ return "structuredTab";
+ }
+ return "rawTab";
+ }
+
+ public void setSelectedTab(String tab) {
+ if (tab.equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ }
+ else {
+ mode = RAW_MODE;
+ }
+ }
+
+ public Object[] getPaths() {
+
+ return getRaws().keySet().toArray();
+ }
+
+ /**
+ *
+ * @return the id associated with the resource.
+ * The value Cached in order to be available on the completeUpload page,
+ * where seeing the resource id conflicts with the rich completeUpload tag.
+ */
+ public int getResourceId() {
+ if (resourceId == null) {
+ resourceId = EnterpriseFacesContextUtility.getResource().getId();
+ }
+ return resourceId;
+ }
+
+ public boolean isStructuredMode() {
+ return mode == STRUCTURED_MODE;
+ }
+
+ public boolean isRawMode() {
+ return mode == RAW_MODE;
+ }
+
+ public boolean isDisplayChangedFilesLabel() {
+ if (isStructuredMode()) {
+ return false;
+ }
+
+ if (isRawSupported()) {
+ return true;
+ }
+
+ return isRawMode();
+ }
+
+ public String getModifiedFilesMsg() {
+ if (!isDisplayChangedFilesLabel() || numberOfModifiedFiles == 0) {
+ return "";
+ }
+
+ if (numberOfModifiedFiles == 1) {
+ return "1 file changed in this configuration";
+ }
+
+ return numberOfModifiedFiles + " files changed in this configuration";
+ }
+
+ public boolean isModified(String path) {
+ return getModified().keySet().contains(path);
+ }
+
+ public boolean isRawSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.RAW;
+ }
+
+ public boolean isStructuredSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED;
+ }
+
+ public boolean isStructuredAndRawSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
+ }
+
+ public boolean isFileUploadAvailable() {
+ return isRawSupported() || (isStructuredAndRawSupported() && isRawMode());
+ }
+
+ /**
+ * Indicates which of the raw configuration files is currently selected.
+ * @param s
+ */
+ public void select(String s) {
+ selectedPath = s;
+ setCurrentPath(selectedPath);
+ setCurrentContents(getCurrentContents());
+ modalEditorContents = getCurrentContents();
+ }
+
+ public void setCurrentContents(String updated) {
+ String original = new String(getCurrent().getContents());
+ if (!updated.equals(original)) {
+ current = current.deepCopy(false);
+ current.setContents(updated);
+
+ markCurrentRawConfigUIBeanModified();
+ getModified().put(current.getPath(), current);
+ }
+ }
+
+ private void markCurrentRawConfigUIBeanModified() {
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(current.getPath());
+ if (bean != null) {
+ bean.setModified(true);
+ }
+ }
+
+ private RawConfigUIBean findRawConfigUIBeanByPath(String path) {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ if (bean.getPath().equals(current.getPath())) {
+ return bean;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setCurrentPath(String path) {
+ RawConfiguration raw = getModified().get(path);
+ if (null == raw) {
+ raw = getRaws().get(path);
+ }
+ if (null != raw) {
+ current = raw;
+ }
+ }
+
+ public void setModified(RawConfiguration raw) {
+ getModified().put(raw.getPath(), raw);
+ }
+
+ public String download() {
+ try {
+ File file = new File(getCurrentPath());
+
+ HttpServletResponse response = FacesContextUtility.getResponse();
+ response.setHeader("Content-Disposition", "attachment;filename=" + file.getName());
+ OutputStream ostream = response.getOutputStream();
+ ostream.write(getCurrentContents().getBytes());
+ ostream.flush();
+ ostream.close();
+
+ FacesContextUtility.getFacesContext().responseComplete();
+
+ return null;
+ }
+ catch (IOException e) {
+ log.error("Failed to complete download request for " + getCurrentPath(), e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * This is a no-op, since the completeUpload work was done by completeUpload file
+ * But is kept as a target for the "save" icon from the full screen page
+ */
+ public String update() {
+ return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId=" + getResourceId();
+ }
+
+ public String completeUpload() {
+ try {
+ if (fileUploader.getFileItem() != null) {
+ UploadItem fileItem = fileUploader.getFileItem();
+ if (fileItem.isTempFile()) {
+ setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
+ }
+ else {
+ setCurrentContents(new String(fileItem.getData()));
+ }
+ fileUploader.clear();
+ }
+
+ return null;
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ void dumpProperties(Configuration conf, Log log) {
+ for (String key : conf.getAllProperties().keySet()) {
+ log.error("property=" + conf.getAllProperties().get(key));
+ }
+ }
+
+ void populateRaws() {
+ Collection<RawConfiguration> rawConfigurations = getConfiguration().getRawConfigurations();
+
+ for (RawConfiguration raw : rawConfigurations) {
+ raws.put(raw.getPath(), raw);
+ }
+ }
+
+ public void setRaws(TreeMap<String, RawConfiguration> raws) {
+ this.raws = raws;
+ }
+
+ public TreeMap<String, RawConfiguration> getRaws() {
+
+ if (null == raws) {
+ raws = new TreeMap<String, RawConfiguration>();
+ populateRaws();
+ }
+
+ return raws;
+ }
+
+ String selectedPath;
+
+ private TreeMap<String, RawConfiguration> raws;
+
+ TreeMap<String, RawConfiguration> modified = new TreeMap<String, RawConfiguration>();
+ RawConfiguration current = null;
+
+}
diff --git a/.gitk-tmp.18588/8/[8d13b5756048cf29672ed6fb717cf0b4539dd60a] ExistingResourceConfigurationUIBean.java b/.gitk-tmp.18588/8/[8d13b5756048cf29672ed6fb717cf0b4539dd60a] ExistingResourceConfigurationUIBean.java
new file mode 100644
index 0000000..feebd98
--- /dev/null
+++ b/.gitk-tmp.18588/8/[8d13b5756048cf29672ed6fb717cf0b4539dd60a] ExistingResourceConfigurationUIBean.java
@@ -0,0 +1,624 @@
+/*
+ * 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.gui.configuration.resource;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Out;
+import org.jetbrains.annotations.Nullable;
+
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.common.upload.FileUploadUIBean;
+import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
+
+import javax.ejb.EJBException;
+import javax.faces.application.FacesMessage;
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+// This class is temporarily decleared in components.xml since it is declared under two names - ViewUIBean and
+// UIBean. This class is undergoing some refactoring and part of that will include declaring the @Name and @Scope
+// annotations again.
+//
+//@Name(value = "ExistingResourceConfigurationViewUIBean")
+//(a)Scope(ScopeType.PAGE)
+public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUIBean {
+ public static final String MANAGED_BEAN_NAME = "ExistingResourceConfigurationUIBean";
+
+ private static final boolean STRUCTURED_MODE = true;
+ private static final boolean RAW_MODE = false;
+
+ private boolean mode = STRUCTURED_MODE;
+
+ @Out
+ private Collection<RawConfigDirectory> rawConfigDirectories;
+
+ @Out
+ private FileUploadUIBean fileUploader = new FileUploadUIBean();
+
+ private String modalEditorContents;
+
+ private int numberOfModifiedFiles;
+
+ public ExistingResourceConfigurationUIBean() {
+ removeSessionScopedBeanIfInView("/rhq/resource/configuration/view.xhtml",
+ ExistingResourceConfigurationUIBean.class);
+ }
+
+ @Create
+ public void begin() {
+ if (isRawSupported() || isStructuredAndRawSupported()) {
+ initConfigDirectories();
+ } else {
+ rawConfigDirectories = Collections.EMPTY_LIST;
+ }
+ }
+
+ private void initConfigDirectories() {
+ Map<String, RawConfigDirectory> dirs = new HashMap<String, RawConfigDirectory>();
+
+ for (RawConfiguration rawConfig : getConfiguration().getRawConfigurations()) {
+ String parentDirPath = getParentDir(rawConfig);
+ RawConfigDirectory dir = dirs.get(parentDirPath);
+
+ if (dir == null) {
+ dir = new RawConfigDirectory();
+ dir.setPath(parentDirPath);
+ }
+
+ dir.addRawConfig(rawConfig);
+ dirs.put(parentDirPath, dir);
+ }
+
+ rawConfigDirectories = dirs.values();
+ }
+
+ private String getParentDir(RawConfiguration rawConfig) {
+ File file = new File(rawConfig.getPath());
+ return file.getParentFile().getAbsolutePath();
+ }
+
+ public String editConfiguration() {
+ mode = STRUCTURED_MODE;
+ return SUCCESS_OUTCOME;
+ }
+
+ public String editRawConfiguration() {
+ mode = RAW_MODE;
+ return SUCCESS_OUTCOME;
+ }
+
+ public void changeTabs(ValueChangeEvent event) {
+ if (event.getNewValue().equals("rawTab")) {
+ switchToRaw();
+ mode = RAW_MODE;
+ } else if (event.getNewValue().equals("structuredTab")) {
+ switchToStructured();
+ mode = STRUCTURED_MODE;
+ }
+ }
+
+ public String switchToRaw() {
+ Configuration configuration = LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(), getConfiguration(), true);
+
+ setConfiguration(configuration);
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ }
+ current = null;
+ setConfiguration(configuration);
+ updateModifiedCache();
+ mode = RAW_MODE;
+ return null;
+ }
+
+ private void updateModifiedCache() {
+ Configuration configuration = getConfiguration();
+
+ for (RawConfiguration updatedRaw : configuration.getRawConfigurations()) {
+ RawConfiguration cachedRaw = modified.get(updatedRaw.getPath());
+ if (cachedRaw != null && !updatedRaw.getSha256().equals(cachedRaw.getSha256())) {
+ modified.remove(cachedRaw.getPath());
+ }
+ }
+ }
+
+ public String switchToStructured() {
+ Configuration configuration = LookupUtil.getConfigurationManager().translateResourceConfiguration(
+ EnterpriseFacesContextUtility.getSubject(), getResourceId(), getMergedConfiguration(), false);
+
+ for (Property property : configuration.getAllProperties().values()) {
+ property.setConfiguration(configuration);
+ }
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ getRaws().put(raw.getPath(), raw);
+ setConfiguration(configuration);
+ }
+ current = null;
+ setConfiguration(configuration);
+
+ for (RawConfiguration raw : configuration.getRawConfigurations()) {
+ System.out.println(raw.getPath() + " -\n" + (new String(raw.getContents())) + "\n");
+ }
+
+ updateModifiedCache();
+
+ mode = STRUCTURED_MODE;
+
+ return null;
+ }
+
+ public String updateConfiguration() {
+ return updateConfiguration(true);
+
+ }
+
+ public String updateRawConfiguration() {
+ return updateConfiguration(false);
+ }
+
+ public void saveModalEditorContents() {
+ setCurrentContents(modalEditorContents);
+ }
+
+ public String updateConfiguration(boolean fromStructured) {
+
+ ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition());
+ int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+
+ try {
+ AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
+ .updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(), resourceId,
+ getMergedConfiguration(), fromStructured);
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ case UNSENT: {
+ for (int i = 0; i < 3; ++i) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
+ "Configuration update was not valid", "" + i);
+ }
+ return FAILURE_OUTCOME;
+ }
+ }
+ } else {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
+ "No changes were made to the configuration, so " + "no update request has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ }
+ return null;
+ } catch (EJBException e) {
+ if (e.getCause() instanceof ConfigurationValidationException) {
+ ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
+
+ for (Iterator<String> i = exception.messageIterator(); i.hasNext();) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "", i.next());
+ }
+ }
+ return FAILURE_OUTCOME;
+ }
+ }
+
+ public String finishAddMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
+ return SUCCESS_OUTCOME;
+ }
+
+ public String finishEditMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map updated.");
+ return SUCCESS_OUTCOME;
+ }
+
+ protected int getConfigurationDefinitionKey() {
+ return EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+ }
+
+ @Nullable
+ protected ConfigurationDefinition lookupConfigurationDefinition() {
+ int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+ ConfigurationDefinition configurationDefinition = this.configurationManager
+ .getResourceConfigurationDefinitionForResourceType(EnterpriseFacesContextUtility.getSubject(),
+ resourceTypeId);
+ return configurationDefinition;
+ }
+
+ protected int getConfigurationKey() {
+ return EnterpriseFacesContextUtility.getResource().getId();
+ }
+
+ protected ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ @Nullable
+ protected Configuration lookupConfiguration() {
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ int resourceId = EnterpriseFacesContextUtility.getResource().getId();
+ AbstractResourceConfigurationUpdate configurationUpdate = this.configurationManager
+ .getLatestResourceConfigurationUpdate(subject, resourceId);
+ Configuration configuration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+ if (configuration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration, getConfigurationDefinition());
+ }
+
+ return configuration;
+ }
+
+ private final Log log = LogFactory.getLog(AbstractConfigurationUIBean.class);
+ private Integer resourceId = null;
+
+ private static final long serialVersionUID = 4837157548556168146L;
+
+ public String commit() {
+
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+ LookupUtil.getConfigurationManager().updateResourceConfiguration(subject, getResourceId(),
+ getMergedConfiguration());
+
+ return "/rhq/resource/configuration/view.xhtml?id=" + getResourceId();
+ }
+
+ private Configuration getMergedConfiguration() {
+ for (RawConfiguration raw : getModified().values()) {
+ getRaws().put(raw.getPath(), raw);
+ log.error("Just merged in raw path =[" + raw.getPath() + "]");
+ log.error(" file =[" + new String(raw.getContents()) + "]");
+
+ }
+ getConfiguration().getRawConfigurations().clear();
+ getConfiguration().getRawConfigurations().addAll(getRaws().values());
+ return getConfiguration();
+ }
+
+ public String editCurrent() {
+ RawConfiguration editedRaw = getCurrent();
+ RawConfiguration originalRaw = raws.get(editedRaw.getPath());
+
+ if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
+ --numberOfModifiedFiles;
+ RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
+ rawUIBean.setModified(false);
+ getModified().remove(editedRaw.getPath());
+ } else {
+ ++numberOfModifiedFiles;
+ }
+ return null;
+ }
+
+ public void undoEdit(String path) {
+ modified.remove(path);
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
+
+ if (bean != null) {
+ bean.setModified(false);
+ bean.setIcon("/images/blank.png");
+ }
+
+ }
+
+ public int getConfigId() {
+ return getConfiguration().getId();
+ }
+
+ private ConfigurationFormat getConfigurationFormat() {
+ return getConfigurationDefinition().getConfigurationFormat();
+ }
+
+ public RawConfiguration getCurrent() {
+ if (null == current) {
+ Iterator<RawConfiguration> iterator = getRaws().values().iterator();
+ if (iterator.hasNext()) {
+ current = iterator.next();
+ } else {
+ current = new RawConfiguration();
+ current.setPath("/dev/null");
+ current.setContents("");
+ }
+ }
+ return current;
+ }
+
+ public String getCurrentContents() {
+ return new String(getCurrent().getContents());
+ }
+
+ public String getCurrentPath() {
+ return getCurrent().getPath();
+ }
+
+ public String getModalEditorHeader() {
+ return getCurrentPath();
+ }
+
+ public String getModalEditorContents() {
+ if (modalEditorContents == null) {
+ modalEditorContents = getCurrentContents();
+ }
+ return modalEditorContents;
+ }
+
+ public void setModalEditorContents(String contents) {
+ modalEditorContents = contents;
+ }
+
+ public TreeMap<String, RawConfiguration> getModified() {
+ if (modified == null) {
+ modified = new TreeMap<String, RawConfiguration>();
+ }
+ return modified;
+ }
+
+ public String getSelectedTab() {
+ if (mode == STRUCTURED_MODE) {
+ return "structuredTab";
+ }
+ return "rawTab";
+ }
+
+ public void setSelectedTab(String tab) {
+ if (tab.equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ } else {
+ mode = RAW_MODE;
+ }
+ }
+
+ public Object[] getPaths() {
+
+ return getRaws().keySet().toArray();
+ }
+
+ /**
+ *
+ * @return the id associated with the resource.
+ * The value Cached in order to be available on the completeUpload page,
+ * where seeing the resource id conflicts with the rich completeUpload tag.
+ */
+ public int getResourceId() {
+ if (resourceId == null) {
+ resourceId = EnterpriseFacesContextUtility.getResource().getId();
+ }
+ return resourceId;
+ }
+
+ public boolean isStructuredMode() {
+ return mode == STRUCTURED_MODE;
+ }
+
+ public boolean isRawMode() {
+ return mode == RAW_MODE;
+ }
+
+ public boolean isDisplayChangedFilesLabel() {
+ if (isStructuredMode()) {
+ return false;
+ }
+
+ if (isRawSupported()) {
+ return true;
+ }
+
+ return isRawMode();
+ }
+
+ public String getModifiedFilesMsg() {
+ if (!isDisplayChangedFilesLabel() || numberOfModifiedFiles == 0) {
+ return "";
+ }
+
+ if (numberOfModifiedFiles == 1) {
+ return "1 file changed in this configuration";
+ }
+
+ return numberOfModifiedFiles + " files changed in this configuration";
+ }
+
+ public boolean isModified(String path) {
+ return getModified().keySet().contains(path);
+ }
+
+ public boolean isRawSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.RAW;
+ }
+
+ public boolean isStructuredSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED;
+ }
+
+ public boolean isStructuredAndRawSupported() {
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
+ }
+
+ public boolean isFileUploadAvailable() {
+ return isRawSupported() || (isStructuredAndRawSupported() && isRawMode());
+ }
+
+ /**
+ * Indicates which of the raw configuration files is currently selected.
+ * @param s
+ */
+ public void select(String s) {
+ selectedPath = s;
+ setCurrentPath(selectedPath);
+ setCurrentContents(getCurrentContents());
+ modalEditorContents = getCurrentContents();
+ }
+
+ public void setCurrentContents(String updated) {
+ String original = new String(getCurrent().getContents());
+ if (!updated.equals(original)) {
+ current = current.deepCopy(false);
+ current.setContents(updated);
+
+ markCurrentRawConfigUIBeanModified();
+ getModified().put(current.getPath(), current);
+ }
+ }
+
+ private void markCurrentRawConfigUIBeanModified() {
+ RawConfigUIBean bean = findRawConfigUIBeanByPath(current.getPath());
+ if (bean != null) {
+ bean.setModified(true);
+ }
+ }
+
+ private RawConfigUIBean findRawConfigUIBeanByPath(String path) {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ if (bean.getPath().equals(current.getPath())) {
+ return bean;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setCurrentPath(String path) {
+ RawConfiguration raw = getModified().get(path);
+ if (null == raw) {
+ raw = getRaws().get(path);
+ }
+ if (null != raw) {
+ current = raw;
+ }
+ }
+
+ public void setModified(RawConfiguration raw) {
+ getModified().put(raw.getPath(), raw);
+ }
+
+ public String download() {
+ try {
+ File file = new File(getCurrentPath());
+
+ HttpServletResponse response = FacesContextUtility.getResponse();
+ response.setHeader("Content-Disposition", "attachment;filename=" + file.getName());
+ OutputStream ostream = response.getOutputStream();
+ ostream.write(getCurrentContents().getBytes());
+ ostream.flush();
+ ostream.close();
+
+ FacesContextUtility.getFacesContext().responseComplete();
+
+ return null;
+ } catch (IOException e) {
+ log.error("Failed to complete download request for " + getCurrentPath(), e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * This is a no-op, since the completeUpload work was done by completeUpload file
+ * But is kept as a target for the "save" icon from the full screen page
+ */
+ public String update() {
+ return "/rhq/resource/configuration/edit-raw.xhtml?currentResourceId=" + getResourceId();
+ }
+
+ public String completeUpload() {
+ try {
+ if (fileUploader.getFileItem() != null) {
+ UploadItem fileItem = fileUploader.getFileItem();
+ if (fileItem.isTempFile()) {
+ setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
+ } else {
+ setCurrentContents(new String(fileItem.getData()));
+ }
+ fileUploader.clear();
+ }
+
+ return null;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ void dumpProperties(Configuration conf, Log log) {
+ for (String key : conf.getAllProperties().keySet()) {
+ log.error("property=" + conf.getAllProperties().get(key));
+ }
+ }
+
+ void populateRaws() {
+ Collection<RawConfiguration> rawConfigurations = getConfiguration().getRawConfigurations();
+
+ for (RawConfiguration raw : rawConfigurations) {
+ raws.put(raw.getPath(), raw);
+ }
+ }
+
+ public void setRaws(TreeMap<String, RawConfiguration> raws) {
+ this.raws = raws;
+ }
+
+ public TreeMap<String, RawConfiguration> getRaws() {
+
+ if (null == raws) {
+ raws = new TreeMap<String, RawConfiguration>();
+ populateRaws();
+ }
+
+ return raws;
+ }
+
+ String selectedPath;
+
+ private TreeMap<String, RawConfiguration> raws;
+
+ TreeMap<String, RawConfiguration> modified = new TreeMap<String, RawConfiguration>();
+ RawConfiguration current = null;
+
+}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
index d28327f..f8f01bc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ConfigurationUpdateStatus.java
@@ -30,7 +30,7 @@ package org.rhq.core.domain.configuration;
* @author John Mazzitelli
*/
public enum ConfigurationUpdateStatus {
- INPROGRESS("In Progress"), SUCCESS("Success"), FAILURE("Failure"),UNSENT("unsent");
+ INPROGRESS("In Progress"), SUCCESS("Success"), FAILURE("Failure");
private String displayName;
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 c07b999..85f13ca 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
@@ -191,21 +191,20 @@ public class ConfigurationManager extends AgentService implements ContainerServi
Configuration structuredConfig = facet.loadStructuredConfiguration();
TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
-
+
if (structuredConfig != null) {
prepareConfigForMergeIntoStructured(configuration, structuredConfig);
for (RawConfiguration rawConfig : configuration.getRawConfigurations()) {
String contents = templateEngine.replaceTokens(new String(rawConfig.getContents()));
rawConfig.setContents(contents);
-
+
structuredConfig.addRawConfiguration(rawConfig);
facet.mergeStructuredConfiguration(rawConfig, configuration);
}
}
}
-
private void prepareConfigForMergeIntoStructured(Configuration config, Configuration latestStructured) {
config.getAllProperties().clear();
for (Property property : latestStructured.getProperties()) {
@@ -223,8 +222,8 @@ public class ConfigurationManager extends AgentService implements ContainerServi
prepareConfigForMergeIntoRaws(configuration, rawConfigs);
Queue<RawConfiguration> queue = new LinkedList<RawConfiguration>(rawConfigs);
- TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
-
+ TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
+
while (!queue.isEmpty()) {
RawConfiguration originalRaw = queue.poll();
RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
@@ -274,7 +273,6 @@ public class ConfigurationManager extends AgentService implements ContainerServi
+ "]: " + msg;
}
-
/**
* Returns a thread pool that this object will use when asychronously executing configuration operations on a
* component.
@@ -339,30 +337,26 @@ public class ConfigurationManager extends AgentService implements ContainerServi
}
public void validate(Configuration configuration, int resourceId, boolean isStructured)
- throws PluginContainerException {
+ throws PluginContainerException {
boolean daemonOnly = true;
boolean onlyIfStarted = true;
ResourceConfigurationFacet facet = componentService.getComponent(resourceId, ResourceConfigurationFacet.class,
FacetLockType.READ, FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- if (isStructured) {
- return;
- } else {
- ArrayList<String> errors = new ArrayList<String>();
- try{
- for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
- try {
- facet.validateRawConfiguration(rawConfiguration);
- } catch (IllegalArgumentException e) {
- errors.add(rawConfiguration.getPath() +" :" + e.getMessage());
- }
+ ArrayList<String> errors = new ArrayList<String>();
+ try {
+ for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
+ try {
+ facet.validateRawConfiguration(rawConfiguration);
+ } catch (IllegalArgumentException e) {
+ errors.add(rawConfiguration.getPath() + " :" + e.getMessage());
}
- }catch(Throwable t){
- errors.clear();
- errors.add("configuation validation failed with" + t.getMessage()+".");
- }
- if (!errors.isEmpty()){
- throw new PluginContainerException(new ConfigurationValidationException(errors));
- }
- }
+ }
+ } catch (Throwable t) {
+ errors.clear();
+ errors.add("configuation validation failed with" + t.getMessage() + ".");
+ }
+ if (!errors.isEmpty()) {
+ throw new PluginContainerException(new ConfigurationValidationException(errors));
+ }
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index ebb3bc6..ca08fb2 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -70,7 +70,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
private boolean mode = STRUCTURED_MODE;
-// @Out
+ // @Out
private Collection<RawConfigDirectory> rawConfigDirectories;
@Out
@@ -225,13 +225,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
return FAILURE_OUTCOME;
- case UNSENT: {
- for (int i = 0; i < 3; ++i) {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
- "Configuration update was not valid", "" + i);
- }
- return FAILURE_OUTCOME;
- }
+
}
} else {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 4eccbff..3d37413 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -23,7 +23,9 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
@@ -980,7 +982,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
public ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
- ConfigurationUpdateStillInProgressException,ConfigurationValidationException {
+ ConfigurationUpdateStillInProgressException, ConfigurationValidationException {
Configuration configToUpdate = newConfiguration;
@@ -995,13 +997,11 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (e.getCause() instanceof ConfigurationValidationException) {
ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
throw exception;
+ } else {
+ List<String> messages = new ArrayList<String>();
+ messages.add(e.getMessage());
+ throw new ConfigurationValidationException(messages);
}
-
- ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null, newConfiguration, subject
- .getName());
- response.setErrorMessage(e.getMessage());
- response.setStatus(ConfigurationUpdateStatus.UNSENT);
- return response;
}
}
commit 7764dc0c6813b37a0603bbb78890f0cdb19ef633
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 17:13:09 2010 -0500
Moving lower edit button outside of tab panel which eliminates some duplication
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 7acdeef..fd6d6e4 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -120,15 +120,6 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
- <s:button id="lowerEditRawButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
- </s:button>
- </h:panelGroup>
- </h:panelGrid>
</rich:tab>
</rich:tabPanel>
<ui:include src="view-raw-modal.xhtml"/>
@@ -147,15 +138,6 @@ THIS TEXT WILL BE REMOVED.
nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
- <s:button id="lowerEditStructuredButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
- </s:button>
- </h:panelGroup>
- </h:panelGrid>
</rich:tab>
</rich:tabPanel>
</c:when>
@@ -169,7 +151,7 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton,fileUpload,upperCommitPanel,lowerCommitPanel">
+ reRender="upperEditButton,lowerEditButton">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -180,22 +162,13 @@ THIS TEXT WILL BE REMOVED.
nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
- <s:button id="lowerEditStructuredButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
- </s:button>
- </h:panelGroup>
- </h:panelGrid>
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton">
+ reRender="upperEditButton,lowerEditButton">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -253,20 +226,21 @@ THIS TEXT WILL BE REMOVED.
</rich:panel>
</h:panelGrid>
</h:panelGrid>
-
- <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
- <s:button id="lowerEditRawButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
- <f:param name="id" value="#{ResourceUIBean.id}"/>
- <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
- </s:button>
- </h:panelGroup>
- </h:panelGrid>
</rich:tab>
</rich:tabPanel>
+
<ui:include src="view-raw-modal.xhtml"/>
</c:when>
</c:choose>
+
+ <h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
+ <h:panelGroup style="text-align:right">
+ <s:button id="lowerEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
+ </h:panelGroup>
+ </h:panelGrid>
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
commit 705a35021deacbf9d085d6dc6f1eb4611bd12288
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 14:46:11 2010 -0500
Updating modal editor to use new seam components
view-raw-modal.xhtml dynamically determines which seam component (configurationViewer or
configurationEditor) to use based on the value of the readOnly variable.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 5da6812..0aca7d5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -187,4 +187,8 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map updated.");
return "success";
}
+
+ public void setModalEditorContents(String contents) {
+ selectedRawUIBean.setContents(contents);
+ }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index 3cab434..d8af346 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -68,7 +68,7 @@ public class ResourceConfigurationViewer {
private Collection<RawConfigDirectory> rawConfigDirectories;
@Out(required = false)
- private RawConfigUIBean selectedRawUIBean;
+ protected RawConfigUIBean selectedRawUIBean;
@RequestParameter("id")
protected int resourceId;
@@ -262,4 +262,12 @@ public class ResourceConfigurationViewer {
}
}
+ public String getModalEditorHeader() {
+ return selectedRawUIBean.getPath();
+ }
+
+ public String getModalEditorContents() {
+ return selectedRawUIBean.getContents();
+ }
+
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index f1f709b..82c3937 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -13,11 +13,20 @@
<c:set var="readOnly" value="true"/>
</c:if>
+ <c:choose>
+ <c:when test="#{readOnly}">
+ <c:set var="editor" value="#{configurationViewer}"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="editor" value="#{configurationEditor}"/>
+ </c:otherwise>
+ </c:choose>
+
<f:subview id="modalEditorSubview">
<rich:modalPanel id="modalEditor" width="800" height="600">
<f:facet name="header">
<h:panelGroup>
- <h:outputText value="#{ExistingResourceConfigurationUIBean.modalEditorHeader}"/>
+ <h:outputText value="#{editor.modalEditorHeader}"/>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
@@ -31,15 +40,14 @@
style="width:100%; height:100%; overflow:visible;"
rows="30"
cols="30"
- value="#{ExistingResourceConfigurationUIBean.modalEditorContents}"
+ value="#{editor.modalEditorContents}"
readonly="#{readOnly}"/>
</rich:panel>
<h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
<h:panelGroup style="text-align:right">
<a4j:commandButton value="Save"
- action="#{ExistingResourceConfigurationUIBean.saveModalEditorContents}"
rendered="#{!readOnly}"
- reRender="fileContents,fileMenu"
+ reRender="fileContents,fileMenu,lowerChangedFilesLabel,upperChangedFilesLabel"
styleClass="buttonmed"
onclick="#{rich:component('modalEditor')}.hide()"/>
<a4j:commandButton value="Cancel" onclick="#{rich:component('modalEditor')}.hide()" styleClass="buttonmed"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index a76af3f..7acdeef 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -220,7 +220,7 @@ THIS TEXT WILL BE REMOVED.
oncomplete="cursor_clear();"
action="#{configurationViewer.select(rawConfigUIBean.path)}"
limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
+ reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
</rich:panelMenuGroup>
</c:forEach>
commit 20f8e8cfb19822b84a260d0ed13a7fe4d51a1228
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 14:03:05 2010 -0500
Adding a param to view-raw-modal.xhtml so that it supports a read-only mode for use in view.xhtml
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw-full.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw-full.xhtml
deleted file mode 100644
index 7f0fc6c..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw-full.xhtml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-
-<ui:composition template="/rhq/layout/main.xhtml">
-
-<ui:param name="pageTitle" value="Upload Configuration File"/>
-<ui:define name="breadcrumbs"></ui:define>
-
-<ui:define name="body">
-
-<h:form id="editResourceConfigurationForm" >
-<input type="hidden" name="id" value="#{ResourceUIBean.id}" />
-<h:commandLink action="#{ExistingResourceConfigurationUIBean.update}" >
- <img src="/images/save.png" alt="#{messages.save}" title="#{messages.save}"/>
- <f:param name="conversationId" value="#{conversation.id}"/>
- <f:param name="id" value="#{ResourceUIBean.id}"/>
-</h:commandLink>
-<div>
-<h:inputTextarea cols="800" rows="600" value="#{ExistingResourceConfigurationUIBean.currentContents}" />
-</div>
-</h:form>
-</ui:define>
-
-</ui:composition>
-
-</html>
-
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index db0047f..8a6aa68 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -323,7 +323,9 @@ THIS TEXT WILL BE REMOVED.
</c:choose>
<ui:include src="upload-modal.xhtml"/>
- <ui:include src="view-raw-modal.xhtml"/>
+ <ui:include src="view-raw-modal.xhtml">
+ <ui:param name="readOnly" value="false"/>
+ </ui:include>
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
index e077962..f1f709b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-modal.xhtml
@@ -3,11 +3,16 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
+ <c:if test="${empty readOnly}">
+ <c:set var="readOnly" value="true"/>
+ </c:if>
+
<f:subview id="modalEditorSubview">
<rich:modalPanel id="modalEditor" width="800" height="600">
<f:facet name="header">
@@ -27,12 +32,13 @@
rows="30"
cols="30"
value="#{ExistingResourceConfigurationUIBean.modalEditorContents}"
- readonly="false"/>
+ readonly="#{readOnly}"/>
</rich:panel>
<h:panelGrid columns="1" columnClasses="raw-edit-footer" style="width:100%">
<h:panelGroup style="text-align:right">
<a4j:commandButton value="Save"
action="#{ExistingResourceConfigurationUIBean.saveModalEditorContents}"
+ rendered="#{!readOnly}"
reRender="fileContents,fileMenu"
styleClass="buttonmed"
onclick="#{rich:component('modalEditor')}.hide()"/>
commit fb997070190a3dca816062c1ebc8d4cfc8f8d23f
Merge: 5d524ae... 0d3d83f...
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Wed Feb 3 13:36:16 2010 -0500
Merge branch 'linux-config' of ssh://git.fedorahosted.org/git/rhq/rhq into linux-config
commit abb29dcd908dbf59efda789a24ab8fd09e7a7092
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 12:53:53 2010 -0500
Refactoring undoEdit methd to just call setContents with the original contents
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 3072851..2e430bb 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -63,12 +63,7 @@ public class RawConfigUIBean {
}
public void undoEdit() {
- Configuration configuration = rawConfiguration.getConfiguration();
- configuration.removeRawConfiguration(rawConfiguration);
- rawConfiguration = originalRawConfiguration.deepCopy(true);
- configuration.addRawConfiguration(rawConfiguration);
-
- fireRawConfigUpdateEvent();
+ setContents(originalRawConfiguration.getContents());
}
private void fireRawConfigUpdateEvent() {
commit d894a042dec51e9ee356f557eff3c03a7f518732
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 12:41:23 2010 -0500
Removing numberOfFilesModified variable as it is not needed.
The value can be obtained from modifiedFiles.size()
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index ee9b08c..5da6812 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -33,7 +33,6 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -47,8 +46,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
private Configuration originalResourceConfiguration;
- private int numberOfFilesModified;
-
private Set<String> modifiedFiles = new HashSet<String>();
@RequestParameter
@@ -101,7 +98,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
// state.
if (!modifiedFiles.contains(rawConfigUIBean.getPath())) {
modifiedFiles.add(rawConfigUIBean.getPath());
- ++numberOfFilesModified;
}
// There is kind of an implicit else block to do nothing. If the file is modified and already in the cache,
// then that means we have already incremented the number of files modified, so we do not need to
@@ -112,7 +108,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
// was previously in a modified state; therefore, we remove it from the cache, and decrement the number of
// files modified.
modifiedFiles.remove(rawConfigUIBean.getPath());
- --numberOfFilesModified;
}
}
@@ -129,15 +124,15 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
}
public String getModifiedFilesMsg() {
- if (!isDisplayChangedFilesLabel() || numberOfFilesModified == 0) {
+ if (!isDisplayChangedFilesLabel() || modifiedFiles.size() == 0) {
return "";
}
- if (numberOfFilesModified == 1) {
+ if (modifiedFiles.size() == 1) {
return "1 file changed in this configuration";
}
- return numberOfFilesModified + " files changed in this configuration";
+ return modifiedFiles.size() + " files changed in this configuration";
}
public String updateConfiguration() {
commit 7686c42ed05858590260d8c28a6f0479d772d7f7
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 12:32:53 2010 -0500
Updating edit.xhtml to support undo operation for raw-only configs
Also update RawConfigUIBean to fire an update event for an undo operation. That along with
rerendering the changed file labels results in the correct number of files changed being
displayed after an undo operation.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java
index 73d8f9f..d187d4a 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java
@@ -1,3 +1,26 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
package org.rhq.core.clientapi.agent.configuration;
import java.io.Serializable;
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 475ed1a..3072851 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -59,7 +59,7 @@ public class RawConfigUIBean {
rawConfiguration.setContents(contents);
configuration.addRawConfiguration(rawConfiguration);
- Events.instance().raiseEvent("rawConfigUpdate", this);
+ fireRawConfigUpdateEvent();
}
public void undoEdit() {
@@ -67,6 +67,12 @@ public class RawConfigUIBean {
configuration.removeRawConfiguration(rawConfiguration);
rawConfiguration = originalRawConfiguration.deepCopy(true);
configuration.addRawConfiguration(rawConfiguration);
+
+ fireRawConfigUpdateEvent();
+ }
+
+ private void fireRawConfigUpdateEvent() {
+ Events.instance().raiseEvent("rawConfigUpdate", this);
}
/** @return The full path name of the raw config file */
@@ -74,10 +80,6 @@ public class RawConfigUIBean {
return rawConfiguration.getPath();
}
- public String getPathAsId() {
- return rawConfiguration.getPath().replace('/', NamingContainer.SEPARATOR_CHAR);
- }
-
/** @return The name of the raw config file excluding its path */
// Note: In the mock-up an asterisk is prepended to the file name in the menu to indicate that it has modifications.
// We may want to modify this method to include logic for that as the UI evolves. If so, it might also be
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 8757de5..ee9b08c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -66,7 +66,6 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
@Override
protected void changeToRawTab() {
resourceConfiguration = translateToRaw();
-// initRawConfigDirectories();
for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
RawConfigUIBean uiBean = findRawConfigUIBeanByPath(raw.getPath());
uiBean.setRawConfiguration(raw);
@@ -82,6 +81,10 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
@Override
protected void changeToStructuredTab() {
resourceConfiguration = translateToStructured();
+ for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+ RawConfigUIBean uiBean = findRawConfigUIBeanByPath(raw.getPath());
+ uiBean.setRawConfiguration(raw);
+ }
}
private Configuration translateToStructured() {
@@ -177,7 +180,7 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
}
/**
- *
+ *
* @return
*/
public String finishAddMap() {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 266b97a..db0047f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -56,7 +56,7 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup id="upperCommitPanel" style="text-align:right">
- <h:outputText id="changedFilesLabel"
+ <h:outputText id="upperChangedFilesLabel"
rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"
value="#{configurationEditor.modifiedFilesMsg}"/>
@@ -91,24 +91,22 @@ THIS TEXT WILL BE REMOVED.
expanded="true"
selectedChild="#{selectedRawUIBean.path}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
- icon="#{rawConfigUIBean.icon}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
- action="#{configurationEditor.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <rich:panelMenuItem label=""
+ icon="#{rawConfigUIBean.icon}">
<h:panelGroup>
- <h:outputText value="#{rawConfigUIBean.fileName}"/>
- <h:commandButton value="Undo"
- styleClass="buttonmed"
- rendered="#{rawConfigUIBean.modified}">
+ <h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onclick"
- onsumbit="cursor_wait()"
+ onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
- action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenu,fileContents"/>
- </h:commandButton>
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel"/>
+ </h:outputLabel>
+ <a4j:commandButton value="Undo"
+ styleClass="buttonmed"
+ rendered="#{rawConfigUIBean.modified}"
+ action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
+ reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel"/>
</h:panelGroup>
</rich:panelMenuItem>
</c:forEach>
@@ -156,7 +154,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup id="lowerCommitPanel" style="text-align:right">
- <h:outputText value="#{configurationEditor.modifiedFilesMsg}"
+ <h:outputText id="lowerChangedFilesLabel"
+ value="#{configurationEditor.modifiedFilesMsg}"
rendered="#{configurationEditor .rawMode}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
@@ -260,7 +259,7 @@ THIS TEXT WILL BE REMOVED.
styleClass="buttonmed"
rendered="#{rawConfigUIBean.modified}"
action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenuPanel,fileContents"/>
+ reRender="fileMenuPanel,fileContents,upperChangedFilesLabel,lowerChangedFilesLabel"/>
</h:panelGroup>
</rich:panelMenuItem>
</c:forEach>
@@ -308,7 +307,7 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup id="lowerCommitPanel" style="text-align:right">
- <h:outputText value="#{configurationEditor.modifiedFilesMsg}"
+ <h:outputText id="lowerChangedFilesLabel" value="#{configurationEditor.modifiedFilesMsg}"
rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
commit 9639d79f1b5ee0cfe90b89ad8849dd94838a05fb
Merge: 48dc406... ced3c1b...
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 11:02:41 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
diff --cc modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 9d43732,ebb3bc6..bcedcfb
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@@ -313,10 -328,9 +328,9 @@@ public class ExistingResourceConfigurat
if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
--numberOfModifiedFiles;
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
- rawUIBean.setModified(false);
+// rawUIBean.setModified(false);
getModified().remove(editedRaw.getPath());
- }
- else {
+ } else {
++numberOfModifiedFiles;
}
return null;
commit 48dc40645ddd0a062e0b7c599f2771bd086769d6
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Feb 3 10:53:01 2010 -0500
Adding and updating support for undo operation in ResourceConfigurationEditor and in edit.xhtml
The undo operation through the file menu now works for resources that support structured and
raw configuration. The code changes still need to be applied to raw-only. I had to refactor
the file menu JSF code a bit. First, the file menu item is now omitted and has been replaced
with a <h:outputLabel>. The undo button was previously rendered with <h:commandButton> and
used <a4j:support>. It is now rendered with <aj4:button>.
These changes allow for each component to respond separately to mouse clicks and the a4j
button allows for an ajax request to be sent instead of a full post-back. Ajax requests
should be possible using,
<h:commandButton>
<a4j:support/>
</h:commandButton>
but for some reason it was causing full post-backs. I also encounted some seam-related
exceptions involving concurrent request timeouts for the same conversation. It is not
clear why those exceptions were getting thrown, but they were causing the undo operatin
to break. Specifying the concurrent-request-timeout attribute for the edit.xhtml page
navigation declaration in pages.xml resolved that issue.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 5ba82bc..475ed1a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -63,7 +63,10 @@ public class RawConfigUIBean {
}
public void undoEdit() {
- rawConfiguration = originalRawConfiguration.deepCopy(false);
+ Configuration configuration = rawConfiguration.getConfiguration();
+ configuration.removeRawConfiguration(rawConfiguration);
+ rawConfiguration = originalRawConfiguration.deepCopy(true);
+ configuration.addRawConfiguration(rawConfiguration);
}
/** @return The full path name of the raw config file */
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index cfdb513..eec0dd8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -17,7 +17,7 @@
<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
- <page view-id="/rhq/resource/configuration/edit.xhtml">
+ <page view-id="/rhq/resource/configuration/edit.xhtml" concurrent-request-timeout="3000">
<action execute="#{configurationEditor.initialize}" on-postback="false"/>
<begin-conversation join="true"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index b520d47..266b97a 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -234,8 +234,6 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1">
<rich:panel id="fileMenuPanel" style="width:100%">
<f:facet name="header">Files</f:facet>
-
-
<rich:panelMenu id="fileMenu"
mode="ajax"
expandMode="client"
@@ -247,24 +245,22 @@ THIS TEXT WILL BE REMOVED.
expanded="true"
selectedChild="#{selectedRawUIBean.path}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
- <rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
- icon="#{rawConfigUIBean.icon}"
- onclick="cursor_wait();"
- oncomplete="cursor_clear();"
- action="#{configurationEditor.select(rawConfigUIBean.path)}"
- limitToList="true"
- reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
+ <rich:panelMenuItem label=""
+ icon="#{rawConfigUIBean.icon}">
<h:panelGroup>
- <h:outputText value="#{#rawConfigUIBean.fileName}"/>
- <h:commandButton value="Undo"
- styleClass="buttonmed"
- rendered="#{rawConfigUIBean.modified}">
+ <h:outputLabel value="#{rawConfigUIBean.fileName}">
<a4j:support event="onclick"
- onsumbit="cursor_wait()"
+ onsubmit="cursor_wait()"
oncomplete="cursor_clear()"
- action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
- reRender="fileMenu,fileContents"/>
- </h:commandButton>
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
+ limitToList="true"
+ reRender="fileContents,selectedFileHeader,modalEditor,fileMenuPanel"/>
+ </h:outputLabel>
+ <a4j:commandButton value="Undo"
+ styleClass="buttonmed"
+ rendered="#{rawConfigUIBean.modified}"
+ action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
+ reRender="fileMenuPanel,fileContents"/>
</h:panelGroup>
</rich:panelMenuItem>
</c:forEach>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 889436f..a76af3f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -195,7 +195,7 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton,fileUpload,upperCommitPanel,lowerCommitPanel">
+ reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
commit ced3c1bea471a0f4285fde2cf4e715214cf19f4d
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 3 09:48:54 2010 -0500
making sure we ignore test output .
diff --git a/.gitignore b/.gitignore
index 1d53abe..b10fd3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
target
target/*
+test-output
+test-output/*
eclipse-classes
eclipse-classes/*
logs
commit 54ea8ca5d38e41919070276a904d198b416d7470
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Feb 3 09:47:49 2010 -0500
removed test-output
diff --git a/test-output/emailable-report.html b/test-output/emailable-report.html
deleted file mode 100644
index 2fec89b..0000000
--- a/test-output/emailable-report.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>TestNG: Unit Test</title>
-<style type="text/css">
-table caption,table.info_table,table.param,table.passed,table.failed {margin-bottom:10px;border:1px solid #000099;border-collapse:collapse;empty-cells:show;}
-table.info_table td,table.info_table th,table.param td,table.param th,table.passed td,table.passed th,table.failed td,table.failed th {
-border:1px solid #000099;padding:.25em .5em .25em .5em
-}
-table.param th {vertical-align:bottom}
-td.numi,th.numi,td.numi_attn {
-text-align:right
-}
-tr.total td {font-weight:bold}
-table caption {
-text-align:center;font-weight:bold;
-}
-table.passed tr.stripe td,table tr.passedodd td {background-color: #00AA00;}
-table.passed td,table tr.passedeven td {background-color: #33FF33;}
-table.passed tr.stripe td,table tr.skippedodd td {background-color: #cccccc;}
-table.passed td,table tr.skippedodd td {background-color: #dddddd;}
-table.failed tr.stripe td,table tr.failedodd td,table.param td.numi_attn {background-color: #FF3333;}
-table.failed td,table tr.failedeven td,table.param tr.stripe td.numi_attn {background-color: #DD0000;}
-tr.stripe td,tr.stripe th {background-color: #E6EBF9;}
-p.totop {font-size:85%;text-align:center;border-bottom:2px black solid}
-div.shootout {padding:2em;border:3px #4854A8 solid}
-</style>
-</head>
-<body>
-<table cellspacing=0 cellpadding=0 class="param">
-<tr><th>Test</th><th class="numi">Methods<br/>Passed</th><th class="numi">Scenarios<br/>Passed</th><th class="numi"># skipped</th><th class="numi"># failed</th><th class="numi">Total<br/>Time</th><th class="numi">Included<br/>Groups</th><th class="numi">Excluded<br/>Groups</th></tr>
-<tr><td style="text-align:left;padding-right:2em">classes</td><td class="numi">8</td><td class="numi">8</td><td class="numi">0</td><td class="numi">0</td><td class="numi">0.2 seconds</td><td class="numi"></td><td class="numi"></td></tr>
-</table>
-<a id="summary"></a>
-<table cellspacing=0 cellpadding=0 class="passed">
-<tr><th>Class</th><th>Method</th><th># of<br/>Scenarios</th><th>Time<br/>(Msecs)</th></tr>
-<tr><th colspan="4">classes — passed</th></tr>
-<tr class="passedodd"><td rowspan="8">org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest<br>"classes"<td><a href="#m1"><b>factoryShouldInitializeLegacyConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">51</td></tr><tr class="passedodd"><td><a href="#m2"><b>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">4</td></tr><tr class="passedodd"><td><a href="#m3"><b>factoryShouldInitializeLoadStructuredAndRawWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">2</td></tr><tr class="passedodd"><td><a href="#m4"><b>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">5</td></tr><tr class="passedodd"><td><a href="#m5"><b>factoryShouldInitializeRawConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">5</td></tr><tr class="passedodd"><td><a href="#m6"><b>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">16</td></tr><tr class="passedodd"><td><a href="#m7"><b>factoryShouldInitializeStructuredConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">14</td></tr><tr class="passedodd"><td><a href="#m8"><b>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">16</td></tr>
-</table>
-<h1>classes</h1>
-<a id="m1"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLegacyConfigMgmtWithComponentService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m2"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m3"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLoadStructuredAndRawWithComponentService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m4"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m5"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeRawConfigMgmtWithComponentService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m6"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m7"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeStructuredConfigMgmtWithComponentService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-<a id="m8"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</h2>
-<p class="totop"><a href="#summary">back to summary</a></p>
-</body></html>
diff --git a/test-output/index.html b/test-output/index.html
deleted file mode 100644
index 87b37e4..0000000
--- a/test-output/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html>
-<head><title>Test results</title><link href="./testng.css" rel="stylesheet" type="text/css" />
-<link href="./my-testng.css" rel="stylesheet" type="text/css" />
-</head><body>
-<h2><p align='center'>Test results</p></h2>
-<table border='1' width='100%' class='main-page'><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Skipped</th><th>testng.xml</th></tr>
-<tr align='center' class='invocation-passed'><td><em>Total</em></td><td><em>8</em></td><td><em>0</em></td><td><em>0</em></td><td> </td></tr>
-<tr align='center' class='invocation-passed'><td><a href='rhq/index.html'>rhq</a></td>
-<td>8</td><td>0</td><td>0</td><td><a href='rhq/testng.xml.html'>Link</a></td></tr></table></body></html>
diff --git a/test-output/rhq/classes.html b/test-output/rhq/classes.html
deleted file mode 100644
index f027d8a..0000000
--- a/test-output/rhq/classes.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<table border='1'>
-<tr>
-<th>Class name</th>
-<th>Method name</th>
-<th>Groups</th>
-</tr><tr>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td> </td><td> </td></tr>
-<tr>
-<td align='center' colspan='3'>@Test</td>
-</tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeRawConfigMgmtWithComponentService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
-<td> </td></tr>
-<tr>
-<td align='center' colspan='3'>@BeforeClass</td>
-</tr>
-<tr>
-<td align='center' colspan='3'>@BeforeMethod</td>
-</tr>
-<tr>
-<td> </td>
-<td>initContext</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>initMocks</td>
-<td> </td></tr>
-<tr>
-<td> </td>
-<td>setup</td>
-<td> </td></tr>
-<tr>
-<td align='center' colspan='3'>@AfterMethod</td>
-</tr>
-<tr>
-<td align='center' colspan='3'>@AfterClass</td>
-</tr>
-</table>
diff --git a/test-output/rhq/classes.properties b/test-output/rhq/classes.properties
deleted file mode 100644
index 1305823..0000000
--- a/test-output/rhq/classes.properties
+++ /dev/null
@@ -1 +0,0 @@
-[SuiteResult classes]
\ No newline at end of file
diff --git a/test-output/rhq/classes.xml b/test-output/rhq/classes.xml
deleted file mode 100644
index 758938a..0000000
--- a/test-output/rhq/classes.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<testsuite name="classes" failures="0" tests="8" time="0.212" errors="0">
- <properties/>
- <testcase name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" time="0.051" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" time="0.004" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" time="0.002" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" time="0.005" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeRawConfigMgmtWithComponentService" time="0.005" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" time="0.016" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" time="0.014" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" time="0.016" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
-</testsuite>
diff --git a/test-output/rhq/groups.html b/test-output/rhq/groups.html
deleted file mode 100644
index 199cb3f..0000000
--- a/test-output/rhq/groups.html
+++ /dev/null
@@ -1 +0,0 @@
-<h2>Groups used for this test run</h2>
\ No newline at end of file
diff --git a/test-output/rhq/index.html b/test-output/rhq/index.html
deleted file mode 100644
index c168c9b..0000000
--- a/test-output/rhq/index.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html><head><title>Results for rhq</title></head>
-<frameset cols="26%,74%">
-<frame src="toc.html" name="navFrame">
-<frame src="main.html" name="mainFrame">
-</frameset>
-</html>
diff --git a/test-output/rhq/main.html b/test-output/rhq/main.html
deleted file mode 100644
index 2240bae..0000000
--- a/test-output/rhq/main.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<html><head><title>Results for rhq</title></head>
-<body>Select a result on the left-hand pane.</body></html>
diff --git a/test-output/rhq/methods-alphabetical.html b/test-output/rhq/methods-alphabetical.html
deleted file mode 100644
index 65038a1..0000000
--- a/test-output/rhq/methods-alphabetical.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>rhq</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
-<table border="1">
-<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()">factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>56</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>63</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()">factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>73</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()">factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>83</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()">factoryShouldInitializeRawConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>116</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>146</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()">factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>175</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-</table>
diff --git a/test-output/rhq/methods-not-run.html b/test-output/rhq/methods-not-run.html
deleted file mode 100644
index 54b14cb..0000000
--- a/test-output/rhq/methods-not-run.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<h2>Methods that were not run</h2><table>
-</table>
\ No newline at end of file
diff --git a/test-output/rhq/methods.html b/test-output/rhq/methods.html
deleted file mode 100644
index 9fe711c..0000000
--- a/test-output/rhq/methods.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>rhq</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
-<table border="1">
-<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-160</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()">factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-104</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-97</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()">factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-87</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()">factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-77</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()">factoryShouldInitializeRawConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-44</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-14</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()">factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
- <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
-<td> </td> <td>main@564660841</td> <td></td> </tr>
-<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>15</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
- <td>main@564660841</td> <td></td> </tr>
-</table>
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html
deleted file mode 100644
index 195d609..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html
+++ /dev/null
@@ -1,596 +0,0 @@
-<html>
-<head>
-<title>TestNG: org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</title>
-<link href="../testng.css" rel="stylesheet" type="text/css" />
-<link href="../my-testng.css" rel="stylesheet" type="text/css" />
-
-<style type="text/css">
-.log { display: none;}
-.stack-trace { display: none;}
-</style>
-<script type="text/javascript">
-<!--
-function flip(e) {
- current = e.style.display;
- if (current == 'block') {
- e.style.display = 'none';
- return 0;
- }
- else {
- e.style.display = 'block';
- return 1;
- }
-}
-
-function toggleBox(szDivId, elem, msg1, msg2)
-{
- var res = -1; if (document.getElementById) {
- res = flip(document.getElementById(szDivId));
- }
- else if (document.all) {
- // this is the way old msie versions work
- res = flip(document.all[szDivId]);
- }
- if(elem) {
- if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
- }
-
-}
-
-function toggleAllBoxes() {
- if (document.getElementsByTagName) {
- d = document.getElementsByTagName('div');
- for (i = 0; i < d.length; i++) {
- if (d[i].className == 'log') {
- flip(d[i]);
- }
- }
- }
-}
-
-// -->
-</script>
-
-</head>
-<body>
-<h2 align='center'>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</h2><table border='1' align="center">
-<tr>
-<td>Tests passed/Failed/Skipped:</td><td>1/7/0</td>
-</tr><tr>
-<td>Started on:</td><td>Tue Feb 02 16:31:43 EST 2010</td>
-</tr>
-<tr><td>Total time:</td><td>189 seconds (189379 ms)</td>
-</tr><tr>
-<td>Included groups:</td><td></td>
-</tr><tr>
-<td>Excluded groups:</td><td></td>
-</tr>
-</table><p/>
-<small><i>(Hover the method name to see the test class name)</i></small><p/>
-<table width='100%' border='1' class='invocation-failed'>
-<tr><td colspan='4' align='center'><b>FAILED TESTS</b></td></tr>
-<tr><td><b>Test method</b></td>
-<td><b>Instance</b></td>
-<td width="10%"><b>Time (seconds)</b></td>
-<td width="30%"><b>Exception</b></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace2020350594", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace2020350594'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()'><b>factoryShouldInitializeLoadStructuredAndRawWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>125</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace917483082", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace917483082'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()'><b>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>55</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1619519236", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace1619519236'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()'><b>factoryShouldInitializeRawConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>1</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1685580695", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace1685580695'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace999186587", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace999186587'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()'><b>factoryShouldInitializeStructuredConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace2120070574", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace2120070574'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
-<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1727921240", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace1727921240'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-</table><p>
-<table width='100%' border='1' class='invocation-passed'>
-<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
-<tr><td><b>Test method</b></td>
-<td><b>Instance</b></td>
-<td width="10%"><b>Time (seconds)</b></td>
-<td width="30%"><b>Exception</b></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()'><b>factoryShouldInitializeLegacyConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
-<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>4</td>
-<td></td>
-</tr>
-</table><p>
-</body>
-</html>
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties
deleted file mode 100644
index 24d8a18..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties
+++ /dev/null
@@ -1 +0,0 @@
-[SuiteResult org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest]
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml
deleted file mode 100644
index 9731c48..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml
+++ /dev/null
@@ -1,173 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<testsuite name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest" failures="7" tests="8" time="189.379" errors="0">
- <properties/>
- <testcase name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" time="4.489" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
- <testcase name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" time="0.008" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" time="125.987" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" time="55.251" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeRawConfigMgmtWithComponentService" time="1.564" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" time="0.692" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" time="0.495" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
- <testcase name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" time="0.544" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
- <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
-expectations:
- allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
- allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
-what happened before this:
- componentService.getResourceType(<-1>)
-
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy5.fetchResourceComponent(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
- at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames]]>
- </failure>
- </testcase>
-</testsuite>
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html
deleted file mode 100644
index a03885a..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html
+++ /dev/null
@@ -1,229 +0,0 @@
-<html>
-<head>
-<title>TestNG: org.rhq.core.pc.configuration.ConfigurationManagerTest</title>
-<link href="../testng.css" rel="stylesheet" type="text/css" />
-<link href="../my-testng.css" rel="stylesheet" type="text/css" />
-
-<style type="text/css">
-.log { display: none;}
-.stack-trace { display: none;}
-</style>
-<script type="text/javascript">
-<!--
-function flip(e) {
- current = e.style.display;
- if (current == 'block') {
- e.style.display = 'none';
- return 0;
- }
- else {
- e.style.display = 'block';
- return 1;
- }
-}
-
-function toggleBox(szDivId, elem, msg1, msg2)
-{
- var res = -1; if (document.getElementById) {
- res = flip(document.getElementById(szDivId));
- }
- else if (document.all) {
- // this is the way old msie versions work
- res = flip(document.all[szDivId]);
- }
- if(elem) {
- if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
- }
-
-}
-
-function toggleAllBoxes() {
- if (document.getElementsByTagName) {
- d = document.getElementsByTagName('div');
- for (i = 0; i < d.length; i++) {
- if (d[i].className == 'log') {
- flip(d[i]);
- }
- }
- }
-}
-
-// -->
-</script>
-
-</head>
-<body>
-<h2 align='center'>org.rhq.core.pc.configuration.ConfigurationManagerTest</h2><table border='1' align="center">
-<tr>
-<td>Tests passed/Failed/Skipped:</td><td>10/0/0</td>
-</tr><tr>
-<td>Started on:</td><td>Tue Feb 02 15:16:58 EST 2010</td>
-</tr>
-<tr><td>Total time:</td><td>0 seconds (539 ms)</td>
-</tr><tr>
-<td>Included groups:</td><td></td>
-</tr><tr>
-<td>Excluded groups:</td><td></td>
-</tr>
-</table><p/>
-<small><i>(Hover the method name to see the test class name)</i></small><p/>
-<table width='100%' border='1' class='invocation-passed'>
-<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
-<tr><td><b>Test method</b></td>
-<td><b>Instance</b></td>
-<td width="10%"><b>Time (seconds)</b></td>
-<td width="30%"><b>Exception</b></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.catchExceptionThrownByFailedValidationOfRawConfigs()'><b>catchExceptionThrownByFailedValidationOfRawConfigs</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull()'><b>exceptionShouldBeThrownIfConfigIsNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td><div><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: returned a null Configuration.
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:264)
- at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull(ConfigurationManagerTest.java:112)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1170987530", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace1170987530'><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: returned a null Configuration.
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:264)
- at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull(ConfigurationManagerTest.java:112)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException()'><b>exceptionShouldBeThrownWhenStrategyThrowsAnException</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td><div><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: An exception was thrown.
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:260)
- at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException(ConfigurationManagerTest.java:132)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
-Caused by: java.lang.RuntimeException
- at org.jmock.lib.action.ThrowAction.invoke(ThrowAction.java:27)
- at org.jmock.internal.InvocationExpectation.invoke(InvocationExpectation.java:114)
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:52)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy11.executeLoad(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:258)
- ... 30 more
-... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1651716188", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
-<div class='stack-trace' id='stack-trace1651716188'><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: An exception was thrown.
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:260)
- at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException(ConfigurationManagerTest.java:132)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
- at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
- at org.rhq.test.JMockTest.run(JMockTest.java:42)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
- at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
- at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
- at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
- at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
- at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
- at org.testng.TestRunner.runWorkers(TestRunner.java:909)
- at org.testng.TestRunner.privateRun(TestRunner.java:618)
- at org.testng.TestRunner.run(TestRunner.java:499)
- at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
- at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
- at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
- at org.testng.SuiteRunner.run(SuiteRunner.java:204)
- at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
- at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
- at org.testng.TestNG.run(TestNG.java:787)
- at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
- at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
-Caused by: java.lang.RuntimeException
- at org.jmock.lib.action.ThrowAction.invoke(ThrowAction.java:27)
- at org.jmock.internal.InvocationExpectation.invoke(InvocationExpectation.java:114)
- at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:52)
- at org.jmock.Mockery.dispatch(Mockery.java:218)
- at org.jmock.Mockery.access$000(Mockery.java:43)
- at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
- at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
- at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
- at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
- at $Proxy11.executeLoad(Unknown Source)
- at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:258)
- ... 30 more
-</pre></div></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingRawsIntoStructuredShouldIgnoreNull()'><b>mergingRawsIntoStructuredShouldIgnoreNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig()'><b>mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStructuredIntoRawShouldDoNothingIfRawsAreNull()'><b>mergingStructuredIntoRawShouldDoNothingIfRawsAreNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStructuredIntoRawShouldIgnoreNulls()'><b>mergingStructuredIntoRawShouldIgnoreNulls</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStucturedIntoRawShouldUpdateLatestRawConfigs()'><b>mergingStucturedIntoRawShouldUpdateLatestRawConfigs</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.strategyShouldBeCalledToLoadConfig()'><b>strategyShouldBeCalledToLoadConfig</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-<tr>
-<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.updatingConfigShouldSubmitRunnerToThreadPool()'><b>updatingConfigShouldSubmitRunnerToThreadPool</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
-<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
-<td></td>
-</tr>
-</table><p>
-</body>
-</html>
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties
deleted file mode 100644
index 84fd129..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties
+++ /dev/null
@@ -1 +0,0 @@
-[SuiteResult org.rhq.core.pc.configuration.ConfigurationManagerTest]
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml
deleted file mode 100644
index a661050..0000000
--- a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<testsuite name="org.rhq.core.pc.configuration.ConfigurationManagerTest" failures="0" tests="10" time="0.539" errors="0">
- <properties/>
- <testcase name="catchExceptionThrownByFailedValidationOfRawConfigs" time="0.042" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="exceptionShouldBeThrownIfConfigIsNull" time="0.011" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="exceptionShouldBeThrownWhenStrategyThrowsAnException" time="0.008" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="mergingRawsIntoStructuredShouldIgnoreNull" time="0.093" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig" time="0.019" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="mergingStructuredIntoRawShouldDoNothingIfRawsAreNull" time="0.018" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="mergingStructuredIntoRawShouldIgnoreNulls" time="0.018" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="mergingStucturedIntoRawShouldUpdateLatestRawConfigs" time="0.023" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="strategyShouldBeCalledToLoadConfig" time="0.021" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
- <testcase name="updatingConfigShouldSubmitRunnerToThreadPool" time="0.09" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
-</testsuite>
diff --git a/test-output/rhq/reporter-output.html b/test-output/rhq/reporter-output.html
deleted file mode 100644
index 063bc2e..0000000
--- a/test-output/rhq/reporter-output.html
+++ /dev/null
@@ -1 +0,0 @@
-<h2>Reporter output</h2><table></table>
\ No newline at end of file
diff --git a/test-output/rhq/testng-failed.xml b/test-output/rhq/testng-failed.xml
deleted file mode 100644
index a243e55..0000000
--- a/test-output/rhq/testng-failed.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Failed suite [rhq]" junit="false" annotations="JDK" data-provider-thread-count="10">
- <test name="classes(failed)" junit="false" annotations="JDK">
- <classes>
- <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <methods>
- <include name="initContext"/>
- <include name="initMocks"/>
- <include name="setup"/>
- <include name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService"/>
- </methods>
- </class>
- </classes>
- </test>
-</suite>
diff --git a/test-output/rhq/testng.xml.html b/test-output/rhq/testng.xml.html
deleted file mode 100644
index 62a0d97..0000000
--- a/test-output/rhq/testng.xml.html
+++ /dev/null
@@ -1 +0,0 @@
-<html><head><title>testng.xml for rhq</title></head><body><tt><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"><br/><suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="rhq" junit="false" annotations="JDK" data-provider-thread-count="10"><br/> <test verbose="2" name="classes" junit="false" annotations="JDK"><br/> <classes><br/> <class name="org.rhq.core.pc.configuration.MockResourceConfigurationFacet"/><br/> <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/><br/> </classes><br/> </test><br/></suite><br/></tt></body></html>
\ No newline at end of file
diff --git a/test-output/rhq/toc.html b/test-output/rhq/toc.html
deleted file mode 100644
index 6328f53..0000000
--- a/test-output/rhq/toc.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-<title>Results for rhq</title>
-<link href="../testng.css" rel="stylesheet" type="text/css" />
-<link href="../my-testng.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-<h3><p align="center">Results for<br/><em>rhq</em></p></h3>
-<table border='1' width='100%'>
-<tr valign='top'>
-<td>1 test</td>
-<td><a target='mainFrame' href='classes.html'>1 class</a></td>
-<td>8 methods:<br/>
- <a target='mainFrame' href='methods.html'>chronological</a><br/>
- <a target='mainFrame' href='methods-alphabetical.html'>alphabetical</a><br/>
- <a target='mainFrame' href='methods-not-run.html'>not run (0)</a></td>
-</tr>
-<tr>
-<td><a target='mainFrame' href='groups.html'>0 group</a></td>
-<td><a target='mainFrame' href='reporter-output.html'>reporter output</a></td>
-<td><a target='mainFrame' href='testng.xml.html'>testng.xml</a></td>
-</tr></table>
-<table width='100%' class='test-passed'>
-<tr><td>
-<table style='width: 100%'><tr><td valign='top'>classes (8/0/0)</td><td valign='top' align='right'>
- <a href='classes.html' target='mainFrame'>Results</a>
-</td></tr></table>
-</td></tr><p/>
-</table>
-</body></html>
\ No newline at end of file
diff --git a/test-output/testng-failed.xml b/test-output/testng-failed.xml
deleted file mode 100644
index a243e55..0000000
--- a/test-output/testng-failed.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Failed suite [rhq]" junit="false" annotations="JDK" data-provider-thread-count="10">
- <test name="classes(failed)" junit="false" annotations="JDK">
- <classes>
- <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <methods>
- <include name="initContext"/>
- <include name="initMocks"/>
- <include name="setup"/>
- <include name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService"/>
- </methods>
- </class>
- </classes>
- </test>
-</suite>
diff --git a/test-output/testng-results.xml b/test-output/testng-results.xml
deleted file mode 100644
index 4faf1c2..0000000
--- a/test-output/testng-results.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<testng-results>
- <reporter-output>
- </reporter-output>
- <suite name="rhq">
- <groups>
- </groups>
- <test name="classes">
- <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="9" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="11" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeLegacyConfigMgmtWithComponentService()" name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" duration-ms="51" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" duration-ms="4" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeLoadStructuredAndRawWithComponentService()" name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" duration-ms="2" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()" name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" duration-ms="5" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeRawConfigMgmtWithComponentService()" name="factoryShouldInitializeRawConfigMgmtWithComponentService" duration-ms="5" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" duration-ms="16" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeStructuredConfigMgmtWithComponentService()" name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" duration-ms="14" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" duration-ms="16" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
- </test-method>
- </class>
- </test>
- </suite>
-</testng-results>
diff --git a/test-output/testng.css b/test-output/testng.css
deleted file mode 100644
index 3904800..0000000
--- a/test-output/testng.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.invocation-failed, .test-failed { background-color: #DD0000; }
-.invocation-percent, .test-percent { background-color: #006600; }
-.invocation-passed, .test-passed { background-color: #00AA00; }
-.invocation-skipped, .test-skipped { background-color: #CCCC00; }
-
-.main-page {
- font-size: x-large;
-}
-
commit e747e439fcdaaa5c23b4cc88c49f4e64c97a5f3f
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Wed Feb 3 15:42:33 2010 +0100
Populate those fields with dummy values - will go away l8er
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index f606de3..d122624 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -101,10 +101,6 @@ public class AlertNotificationLog implements Serializable {
public AlertNotificationLog(Alert alert) {
AlertDefinition alertDefinition = alert.getAlertDefinition();
- StringBuilder rolesBuilder = new StringBuilder();
- StringBuilder subjectsBuilder = new StringBuilder();
- StringBuilder emailsBuilder = new StringBuilder();
-
List<AlertNotification> currentNotifications = alertDefinition.getAlertNotifications();
for (AlertNotification notification : currentNotifications) {
//((SnmpNotification)notification).
@@ -113,6 +109,9 @@ public class AlertNotificationLog implements Serializable {
// always make sure each notification field is non-null by "fixing" it
this.alert = alert;
+ this.roles ="(none)";
+ this.subjects ="(none)";
+ this.emails ="(none)";
}
private String fixup(StringBuilder builder) {
commit f9f5d99c36530d167b3e22ab545d6920d1072dd0
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Wed Feb 3 10:51:35 2010 +0100
Clean out old stuff that is no longer needed du to alert plugins.
diff --git a/etc/eclipse-tools/hibernate.cfg.xml b/etc/eclipse-tools/hibernate.cfg.xml
index a4160cf..b335365 100644
--- a/etc/eclipse-tools/hibernate.cfg.xml
+++ b/etc/eclipse-tools/hibernate.cfg.xml
@@ -18,8 +18,8 @@
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
-->
-
- <property name="hibernate.cache.use_second_level_cache">false</property>
+
+ <property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.use_query_cache">false</property>
<mapping class="org.rhq.core.domain.auth.Principal" />
@@ -106,10 +106,7 @@
<mapping class="org.rhq.core.domain.alert.AlertDefinition" />
<mapping class="org.rhq.core.domain.alert.notification.AlertNotification" />
<mapping class="org.rhq.core.domain.alert.notification.AlertNotificationLog" />
- <mapping class="org.rhq.core.domain.alert.notification.EmailNotification" />
- <mapping class="org.rhq.core.domain.alert.notification.RoleNotification" />
- <mapping class="org.rhq.core.domain.alert.notification.SnmpNotification" />
- <mapping class="org.rhq.core.domain.alert.notification.SubjectNotification" />
+ <mapping class="org.rhq.core.domain.alert.notification.NotificationTemplate" />
<mapping class="org.rhq.core.domain.measurement.calltime.CallTimeDataKey" />
<mapping class="org.rhq.core.domain.measurement.calltime.CallTimeDataValue" />
<mapping class="org.rhq.core.domain.resource.group.Group" />
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index a0481b7..a3da84c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.77.2</db.schema.version>
+ <db.schema.version>2.77.3</db.schema.version>
</properties>
<dependencies>
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
index 2cbba05..6a06d64 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/alert-schema.xml
@@ -133,8 +133,6 @@
<column name="NOTIFICATION_TYPE" required="true" size="20" type="VARCHAR2"/>
<column name="ALERT_DEFINITION_ID" required="false" type="INTEGER" references="RHQ_ALERT_DEFINITION(ID)"/>
<column name="NOTIF_TEMPLATE_ID" required="false" type="INTEGER" references="RHQ_ALERT_NOTIF_TEMPL(ID)"/>
- <column name="ROLE_ID" type="INTEGER" references="RHQ_ROLE(ID)"/>
- <column name="SUBJECT_ID" type="INTEGER" references="RHQ_SUBJECT(ID)"/>
<column name="ALERT_CONFIG_ID" required="false" type="INTEGER" references="RHQ_CONFIG(ID)"/>
<column name="ALERT_SENDER_NAME" required="false" size="100" type="VARCHAR2" /> <!-- TODO make required = true -->
<column name="ALERT_ORDER" type="INTEGER" />
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index e9cb6ce..c3d4006 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3014,6 +3014,10 @@
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="snmp_oid"/>
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="email_address"/>
</schemaSpec>
+ <schemaSpec version="2.77.3">
+ <schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="role_id"/>
+ <schema-deleteColumn table="RHQ_ALERT_NOTIFICATION" column="subject_id"/>
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
index 531a1cd..f606de3 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/AlertNotificationLog.java
@@ -107,28 +107,11 @@ public class AlertNotificationLog implements Serializable {
List<AlertNotification> currentNotifications = alertDefinition.getAlertNotifications();
for (AlertNotification notification : currentNotifications) {
- if (notification instanceof RoleNotification) {
- if (rolesBuilder.length() != 0) {
- rolesBuilder.append(", ");
- }
-
- rolesBuilder.append(((RoleNotification) notification).getRole().getName());
- } else if (notification instanceof SubjectNotification) {
- if (subjectsBuilder.length() != 0) {
- subjectsBuilder.append(", ");
- }
-
- subjectsBuilder.append(((SubjectNotification) notification).getSubject().getName());
- } else {
//((SnmpNotification)notification).
// TODO: log that this type of AlertNotification is not supported yet for auditing
- }
}
// always make sure each notification field is non-null by "fixing" it
- roles = fixup(rolesBuilder);
- subjects = fixup(subjectsBuilder);
- emails = fixup(emailsBuilder);
this.alert = alert;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/RoleNotification.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/RoleNotification.java
deleted file mode 100644
index 696895b..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/RoleNotification.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.alert.notification;
-
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-
-import org.jetbrains.annotations.NotNull;
-
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.authz.Role;
-
-@DiscriminatorValue("ROLE")
-@Entity
-@NamedQueries( {
- @NamedQuery(name = RoleNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID, query = "SELECT rn "
- + " FROM RoleNotification rn " + " WHERE rn.alertDefinition.id = :alertDefinitionId "),
- @NamedQuery(name = RoleNotification.QUERY_FIND_BY_IDS, query = "SELECT rn " + " FROM RoleNotification rn "
- + " WHERE rn.id IN ( :ids )"),
- @NamedQuery(name = RoleNotification.QUERY_FIND_BY_ROLE_IDS, query = "SELECT rn " + " FROM RoleNotification rn "
- + " WHERE rn.role.id IN ( :ids )") })
-@Deprecated
-public class RoleNotification extends AlertNotification {
-
- private static final long serialVersionUID = 1L;
-
- public static final String QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID = "RoleNotification.findAllByAlertDefinitionId";
- public static final String QUERY_FIND_BY_IDS = "RoleNotification.findByIds";
- public static final String QUERY_FIND_BY_ROLE_IDS = "SubjectNotification.findByRoleIds";
-
- @JoinColumn(name = "ROLE_ID", referencedColumnName = "ID", nullable = true)
- @ManyToOne
- private Role role;
-
- protected RoleNotification() {
- } // JPA spec
-
- public RoleNotification(RoleNotification roleNotification) {
- this(roleNotification.getAlertDefinition(), roleNotification.role);
- }
-
- public RoleNotification(@NotNull AlertDefinition alertDefinition, @NotNull Role role) {
- super(alertDefinition);
- if (role == null) {
- throw new IllegalArgumentException("role must be non-null.");
- }
-
- this.role = role;
- }
-
- @NotNull
- public Role getRole() {
- return role;
- }
-
- @Override
- protected AlertNotification copy() {
- return new RoleNotification(this);
- }
-
- @Override
- public void prepareForOrphanDelete() {
- super.prepareForOrphanDelete();
- role = null;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + ((role == null) ? 0 : role.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (!(obj instanceof RoleNotification)) {
- return false;
- }
-
- final RoleNotification other = (RoleNotification) obj;
- if (role == null) {
- if (other.role != null) {
- return false;
- }
- } else if (!role.equals(other.role)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + "[" + "id=" + getId() + ", " + "role=" + this.role + ", " + "]";
- }
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SubjectNotification.java b/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SubjectNotification.java
deleted file mode 100644
index 18a90bc..0000000
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/alert/notification/SubjectNotification.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.rhq.core.domain.alert.notification;
-
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-
-import org.jetbrains.annotations.NotNull;
-
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.auth.Subject;
-
-@DiscriminatorValue("SUBJECT")
-@Entity
-@NamedQueries( {
- @NamedQuery(name = SubjectNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID, query = "SELECT sn "
- + " FROM SubjectNotification sn " + " WHERE sn.alertDefinition.id = :alertDefinitionId "),
- @NamedQuery(name = SubjectNotification.QUERY_FIND_BY_IDS, query = "SELECT sn " + " FROM SubjectNotification sn "
- + " WHERE sn.id IN ( :ids )"),
- @NamedQuery(name = SubjectNotification.QUERY_FIND_BY_SUBJECT_IDS, query = "SELECT sn "
- + " FROM SubjectNotification sn " + " WHERE sn.subject.id IN ( :ids )") })
-@Deprecated
-public class SubjectNotification extends AlertNotification {
-
- private static final long serialVersionUID = 1L;
-
- public static final String QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID = "SubjectNotification.findAllByAlertDefinitionId";
- public static final String QUERY_FIND_BY_IDS = "SubjectNotification.findByIds";
- public static final String QUERY_FIND_BY_SUBJECT_IDS = "SubjectNotification.findBySubjectIds";
-
- @JoinColumn(name = "SUBJECT_ID", referencedColumnName = "ID", nullable = true)
- @ManyToOne
- private Subject subject;
-
- protected SubjectNotification() {
- } // JPA spec
-
- public SubjectNotification(SubjectNotification subjectNotification) {
- this(subjectNotification.getAlertDefinition(), subjectNotification.subject);
- }
-
- public SubjectNotification(@NotNull AlertDefinition alertDefinition, @NotNull Subject subject) {
- super(alertDefinition);
- if (subject == null) {
- throw new IllegalArgumentException("subject must be non-null.");
- }
-
- this.subject = subject;
- }
-
- @NotNull
- public Subject getSubject() {
- return subject;
- }
-
- @Override
- protected AlertNotification copy() {
- return new SubjectNotification(this);
- }
-
- @Override
- public void prepareForOrphanDelete() {
- super.prepareForOrphanDelete();
- subject = null;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + ((subject == null) ? 0 : subject.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj == null) {
- return false;
- }
-
- if (!(obj instanceof SubjectNotification)) {
- return false;
- }
-
- final SubjectNotification other = (SubjectNotification) obj;
- if (subject == null) {
- if (other.subject != null) {
- return false;
- }
- } else if (!subject.equals(other.subject)) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + "[" + "id=" + getId() + ", " + "subject=" + this.subject + ", " + "]";
- }
-}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
index 2aadf7d..f13d6ef 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/auth/Subject.java
@@ -49,7 +49,6 @@ import javax.persistence.Transient;
import org.jetbrains.annotations.NotNull;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.util.EntitySerializer;
@@ -140,28 +139,6 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "FROM Subject s, IN (s.roles) r, IN (r.permissions) p, IN (r.resourceGroups) g, IN (g.implicitResources) res "
+ "WHERE s = :subject AND p = :permission"),
- @NamedQuery(name = Subject.QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION_WITH_EXCLUDES, query = "" //
- + "SELECT s" + " FROM Subject s" //
- + " WHERE s.id NOT IN" //
- + " ( " //
- + " SELECT sn.subject.id" //
- + " FROM SubjectNotification sn" //
- + " WHERE sn.alertDefinition.id = :alertDefinitionId " //
- + " ) " //
- + " AND s.id NOT IN ( :excludes ) " //
- + " AND s.fsystem = FALSE " //
- + " AND s.factive = TRUE"),
- @NamedQuery(name = Subject.QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION, query = "" //
- + "SELECT s" //
- + " FROM Subject s" //
- + " WHERE s.id NOT IN" //
- + " ( " //
- + " SELECT sn.subject.id" //
- + " FROM SubjectNotification sn" //
- + " WHERE sn.alertDefinition.id = :alertDefinitionId " //
- + " ) " //
- + " AND s.fsystem = FALSE" //
- + " AND s.factive = TRUE"), //
@NamedQuery(name = Subject.QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ROLE_WITH_EXCLUDES, query = "" //
+ "SELECT DISTINCT s " + " FROM Subject AS s LEFT JOIN s.roles AS r " //
+ " WHERE s.id NOT IN " //
@@ -211,8 +188,6 @@ public class Subject implements Externalizable {
public static final String QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ROLE_WITH_EXCLUDES = "Subject.findAvailableSubjectsForRoleWithExcludes";
public static final String QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ROLE = "Subject.findAvailableSubjectsForRole";
- public static final String QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION_WITH_EXCLUDES = "Subject.findAvailableSubjectsForAlertDefinitionWithExcludes";
- public static final String QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION = "Subject.findAvailableSubjectForAlertDefinition";
public static final String QUERY_DYNAMIC_CONFIG_VALUES = "Subject.dynamicConfigValues";
@@ -258,9 +233,6 @@ public class Subject implements Externalizable {
@ManyToMany
private java.util.Set<Role> roles;
- @OneToMany(mappedBy = "subject", cascade = javax.persistence.CascadeType.ALL)
- private Set<SubjectNotification> subjectNotifications = new HashSet<SubjectNotification>();
-
@Transient
private Integer sessionId = null;
@@ -410,18 +382,6 @@ public class Subject implements Externalizable {
getRoles().remove(role);
}
- public Set<SubjectNotification> getSubjectNotifications() {
- return subjectNotifications;
- }
-
- public void setSubjectNotifications(Set<SubjectNotification> subjectNotifications) {
- this.subjectNotifications = subjectNotifications;
- }
-
- public void addSubjectNotification(SubjectNotification subjectNotification) {
- this.subjectNotifications.add(subjectNotification);
- }
-
@Override
public String toString() {
return "org.rhq.core.domain.auth.Subject[id=" + id + ",name=" + name + "]";
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
index 482fa08..35772bd 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/authz/Role.java
@@ -46,7 +46,6 @@ import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.CollectionOfElements;
import org.jetbrains.annotations.NotNull;
-import org.rhq.core.domain.alert.notification.RoleNotification;
import org.rhq.core.domain.auth.Subject;
/**
@@ -78,19 +77,6 @@ import org.rhq.core.domain.auth.Subject;
+ " FROM Subject ss " //
+ " JOIN ss.roles AS rr " //
+ " WHERE ss.id = :subjectId )"), //
- @NamedQuery(name = Role.QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION_WITH_EXCLUDES, query = "" //
- + "SELECT r" //
- + " FROM Role r" //
- + " WHERE r.id NOT IN ( SELECT rn.role.id " //
- + " FROM RoleNotification rn" //
- + " WHERE rn.alertDefinition.id = :alertDefinitionId ) " //
- + " AND r.id NOT IN ( :excludes )"), //
- @NamedQuery(name = Role.QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION, query = "" //
- + "SELECT r" //
- + " FROM Role r" //
- + " WHERE r.id NOT IN ( SELECT rn.role.id " //
- + " FROM RoleNotification rn" //
- + " WHERE rn.alertDefinition.id = :alertDefinitionId ) "), //
@NamedQuery(name = Role.QUERY_DYNAMIC_CONFIG_VALUES, query = "" //
+ "SELECT r.name, r.name FROM Role AS r")
})
@@ -101,8 +87,6 @@ public class Role implements Serializable {
public static final String QUERY_FIND_BY_IDS = "Role.findByIds";
public static final String QUERY_FIND_AVAILABLE_ROLES_WITH_EXCLUDES = "Role.findAvailableRolesWithExcludes";
public static final String QUERY_FIND_AVAILABLE_ROLES = "Role.findAvailableRoles";
- public static final String QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION_WITH_EXCLUDES = "Role.findAvailableRolesForAlertDefinitionWithExcludes";
- public static final String QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION = "Role.findAvailableRolesForAlertDefinition";
public static final String QUERY_DYNAMIC_CONFIG_VALUES = "Role.dynamicConfigValues";
@@ -134,9 +118,6 @@ public class Role implements Serializable {
@JoinTable(name = "RHQ_PERMISSION", joinColumns = @JoinColumn(name = "ROLE_ID"))
private Set<Permission> permissions = new HashSet<Permission>();
- @OneToMany(mappedBy = "role", cascade = javax.persistence.CascadeType.ALL)
- private Set<RoleNotification> roleNotifications = new HashSet<RoleNotification>();
-
protected Role() {
fsystem = Boolean.FALSE;
}
@@ -251,18 +232,6 @@ public class Role implements Serializable {
this.resourceGroups.remove(resourceGroup);
}
- public Set<RoleNotification> getRoleNotifications() {
- return roleNotifications;
- }
-
- public void setRoleNotifications(Set<RoleNotification> roleNotifications) {
- this.roleNotifications = roleNotifications;
- }
-
- public void addRoleNotification(RoleNotification roleNotification) {
- this.roleNotifications.add(roleNotification);
- }
-
public int getMemberCount() {
int count = 0;
for (Subject member : getSubjects()) {
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java
index 4d873f6..530acb1 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/test/QueryAllTest.java
@@ -45,8 +45,6 @@ import org.rhq.core.domain.alert.AlertCondition;
import org.rhq.core.domain.alert.AlertConditionLog;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.notification.AlertNotification;
-import org.rhq.core.domain.alert.notification.RoleNotification;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.auth.Principal;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
@@ -122,8 +120,6 @@ public class QueryAllTest extends AbstractEJB3Test {
AlertConditionLog.class.getSimpleName(),
AlertDefinition.class.getSimpleName(),
AlertNotification.class.getSimpleName(),
- RoleNotification.class.getSimpleName(),
- SubjectNotification.class.getSimpleName(),
// measurement stuff
MeasurementDataTrait.class.getSimpleName(),
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesAction.java
deleted file mode 100644
index 66b2005..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.gui.legacy.Constants;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-import org.rhq.enterprise.gui.legacy.util.SessionUtils;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * An action that adds roles to an alert definition in the BizApp.
- */
-public class AddRolesAction extends AddNotificationsAction {
- private Log log = LogFactory.getLog(AddRolesAction.class);
-
- @Override
- @SuppressWarnings("deprecation")
- protected ActionForward process(ActionMapping mapping, AddNotificationsForm form, HttpServletRequest request,
- Map<String, Integer> params) throws Exception {
- AddRolesForm addForm = (AddRolesForm) form;
- ActionForward forward = checkSubmit(request, mapping, addForm, params);
- HttpSession session = request.getSession();
- Subject subject = RequestUtils.getSubject(request);
-
- if (forward != null) {
- if (addForm.isCancelClicked() || addForm.isResetClicked()) {
- log.debug("removing pending role list");
- SessionUtils.removeList(session, Constants.PENDING_ROLES_SES_ATTR);
- } else if (addForm.isAddClicked()) {
- log.debug("adding to pending role list");
- SessionUtils.addToList(session, Constants.PENDING_ROLES_SES_ATTR, addForm.getAvailableRoles());
- log.debug("@@@@@@@@@@" + addForm.getAvailableRoles().toString());
- } else if (addForm.isRemoveClicked()) {
- log.debug("removing from pending role list");
- SessionUtils.removeFromList(session, Constants.PENDING_ROLES_SES_ATTR, addForm.getPendingRoles());
- }
-
- return forward;
- }
-
- log.debug("getting pending role list");
- Integer[] pendingRoleIds = SessionUtils.getList(session, Constants.PENDING_ROLES_SES_ATTR);
- for (int i = 0; i < pendingRoleIds.length; i++) {
- log.debug("adding role [" + pendingRoleIds[i] + "] for alert definition [" + addForm.getAd() + "]");
- }
-
- AlertNotificationManagerLocal alertNotificationManager = LookupUtil.getAlertNotificationManager();
- alertNotificationManager.addRoleNotifications(subject, addForm.getAd(), pendingRoleIds);
-
- log.debug("remove pending role list");
- SessionUtils.removeList(session, Constants.PENDING_ROLES_SES_ATTR);
-
- RequestUtils.setConfirmation(request, "alerts.config.confirm.AddRoles");
- return returnSuccess(request, mapping, params);
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesForm.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesForm.java
deleted file mode 100644
index 6f4dea8..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesForm.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionMapping;
-
-/**
- * An extension of <code>BaseValidatorForm</code> representing the <em>Add Role</em> form.
- */
-public class AddRolesForm extends AddNotificationsForm {
- private Integer[] availableRoles;
- private Integer[] pendingRoles;
- private Integer psa;
- private Integer psp;
-
- public AddRolesForm() {
- super();
- }
-
- public Integer[] getAvailableRole() {
- return this.availableRoles;
- }
-
- public Integer[] getAvailableRoles() {
- return getAvailableRole();
- }
-
- public void setAvailableRole(Integer[] availableRoles) {
- this.availableRoles = availableRoles;
- }
-
- public void setAvailableRoles(Integer[] availableRoles) {
- setAvailableRole(availableRoles);
- }
-
- public Integer[] getPendingRole() {
- return this.pendingRoles;
- }
-
- public Integer[] getPendingRoles() {
- return getPendingRole();
- }
-
- public void setPendingRole(Integer[] pendingRoles) {
- this.pendingRoles = pendingRoles;
- }
-
- public void setPendingRoles(Integer[] pendingRoles) {
- setPendingRole(pendingRoles);
- }
-
- public Integer getPsa() {
- return this.psa;
- }
-
- public void setPsa(Integer ps) {
- this.psa = ps;
- }
-
- public Integer getPsp() {
- return this.psp;
- }
-
- public void setPsp(Integer ps) {
- this.psp = ps;
- }
-
- @Override
- public void reset(ActionMapping mapping, HttpServletRequest request) {
- this.availableRoles = new Integer[0];
- this.pendingRoles = new Integer[0];
- this.psa = null;
- this.psp = null;
- super.reset(mapping, request);
- }
-
- @Override
- public String toString() {
- StringBuffer s = new StringBuffer(super.toString());
- s.append("ad=" + ad + " ");
- s.append("psa=" + psa + " ");
- s.append("psp=" + psp + " ");
-
- s.append("availableRoles={");
- listToString(s, availableRoles);
- s.append("} ");
-
- s.append("pendingRoles={");
- listToString(s, pendingRoles);
- s.append("}");
-
- return s.toString();
- }
-
- private void listToString(StringBuffer s, Integer[] l) {
- if (l != null) {
- for (int i = 0; i < l.length; i++) {
- s.append(l[i]);
- if (i < (l.length - 1)) {
- s.append(", ");
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesFormPrepareAction.java
deleted file mode 100644
index 3d7d9f7..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddRolesFormPrepareAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.tiles.ComponentContext;
-import org.apache.struts.tiles.actions.TilesAction;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.authz.Role;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.legacy.Constants;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-import org.rhq.enterprise.gui.legacy.util.SessionUtils;
-import org.rhq.enterprise.gui.util.WebUtility;
-import org.rhq.enterprise.server.authz.RoleManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * An Action that retrieves data from the BizApp to facilitate display of the form to add roles to AlertDefinition.
- */
-public class AddRolesFormPrepareAction extends TilesAction {
- private Log log = LogFactory.getLog(AddRolesFormPrepareAction.class);
-
- @Override
- @SuppressWarnings("deprecation")
- public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) throws Exception {
- AddRolesForm addForm = (AddRolesForm) form;
- Subject subject = RequestUtils.getSubject(request);
-
- PageControl pcp = WebUtility.getPageControl(request, "p");
- PageControl pca = WebUtility.getPageControl(request, "a");
-
- log.trace("available page control: " + pca);
- log.trace("pending page control: " + pcp);
-
- RoleManagerLocal roleManager = LookupUtil.getRoleManager();
-
- /*
- * pending users are those on the right side of the "add to list" widget - awaiting association with the Alert
- * Definition when the form's "ok" button is clicked.
- */
- Integer[] pendingIds = SessionUtils.getList(request.getSession(), Constants.PENDING_ROLES_SES_ATTR);
-
- log.trace("getting pending roles for alert definition [" + addForm.getAd() + "]");
- PageList<Role> pendingUsers = roleManager.findRolesByIds(pendingIds, pcp);
- request.setAttribute(Constants.PENDING_ROLES_ATTR, pendingUsers);
-
- /*
- * available users are all users in the system that are _not_ associated with the definition and are not pending
- */
- log.trace("getting available roles for alert definition [" + addForm.getAd() + "]");
- PageList<Role> availableUsers = roleManager.findAvailableRolesForAlertDefinition(subject, addForm.getAd(),
- pendingIds, pca);
- request.setAttribute(Constants.AVAIL_ROLES_ATTR, availableUsers);
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersAction.java
deleted file mode 100644
index 6c05694..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.gui.legacy.Constants;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-import org.rhq.enterprise.gui.legacy.util.SessionUtils;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * An action that adds users to an alert definition in the BizApp.
- */
-public class AddUsersAction extends AddNotificationsAction {
- private Log log = LogFactory.getLog(AddUsersAction.class);
-
- @Override
- protected ActionForward process(ActionMapping mapping, AddNotificationsForm form, HttpServletRequest request,
- Map<String, Integer> params) throws Exception {
- AddUsersForm addForm = (AddUsersForm) form;
- ActionForward forward = checkSubmit(request, mapping, form, params);
- HttpSession session = request.getSession();
- Subject subject = RequestUtils.getSubject(request);
-
- if (forward != null) {
- if (addForm.isCancelClicked() || addForm.isResetClicked()) {
- log.debug("removing pending user list");
- SessionUtils.removeList(session, Constants.PENDING_USERS_SES_ATTR);
- } else if (addForm.isAddClicked()) {
- log.debug("adding to pending user list");
- SessionUtils.addToList(session, Constants.PENDING_USERS_SES_ATTR, addForm.getAvailableUsers());
- log.debug("@@@@@@@@@@" + addForm.getAvailableUsers().toString());
- for (int i = 0; i < addForm.getAvailableUsers().length; i++) {
- log.debug("Avalilable Users " + addForm.getAvailableUsers()[i]);
- }
- } else if (addForm.isRemoveClicked()) {
- log.debug("removing from pending user list");
- SessionUtils.removeFromList(session, Constants.PENDING_USERS_SES_ATTR, addForm.getPendingUsers());
- }
-
- return forward;
- }
-
- log.debug("getting pending user list");
- Integer[] pendingUserIds = SessionUtils.getList(session, Constants.PENDING_USERS_SES_ATTR);
- for (int i = 0; i < pendingUserIds.length; i++) {
- log.debug("adding user [" + pendingUserIds[i] + "] for alert definition [" + addForm.getAd() + "]");
- }
-
- AlertNotificationManagerLocal alertNotificationManager = LookupUtil.getAlertNotificationManager();
- alertNotificationManager.addSubjectNotifications(subject, addForm.getAd(), pendingUserIds);
-
- log.debug("remove pending user list");
- SessionUtils.removeList(session, Constants.PENDING_USERS_SES_ATTR);
-
- RequestUtils.setConfirmation(request, "alerts.config.confirm.AddRoles");
- return returnSuccess(request, mapping, params);
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersForm.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersForm.java
deleted file mode 100644
index 7b5600e..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersForm.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.struts.action.ActionMapping;
-
-/**
- * An extension of <code>BaseValidatorForm</code> representing the <em>Add Role Users</em> form.
- */
-public class AddUsersForm extends AddNotificationsForm {
- private Integer[] availableUsers;
- private Integer[] pendingUsers;
- private Integer psa;
- private Integer psp;
-
- public AddUsersForm() {
- super();
- }
-
- public Integer[] getAvailableUser() {
- return this.availableUsers;
- }
-
- public Integer[] getAvailableUsers() {
- return getAvailableUser();
- }
-
- public void setAvailableUser(Integer[] availableUsers) {
- this.availableUsers = availableUsers;
- }
-
- public void setAvailableUsers(Integer[] availableUsers) {
- setAvailableUser(availableUsers);
- }
-
- public Integer[] getPendingUser() {
- return this.pendingUsers;
- }
-
- public Integer[] getPendingUsers() {
- return getPendingUser();
- }
-
- public void setPendingUser(Integer[] pendingUsers) {
- this.pendingUsers = pendingUsers;
- }
-
- public void setPendingUsers(Integer[] pendingUsers) {
- setPendingUser(pendingUsers);
- }
-
- public Integer getPsa() {
- return this.psa;
- }
-
- public void setPsa(Integer ps) {
- this.psa = ps;
- }
-
- public Integer getPsp() {
- return this.psp;
- }
-
- public void setPsp(Integer ps) {
- this.psp = ps;
- }
-
- @Override
- public void reset(ActionMapping mapping, HttpServletRequest request) {
- this.availableUsers = new Integer[0];
- this.pendingUsers = new Integer[0];
- this.psa = null;
- this.psp = null;
- this.ad = null;
- super.reset(mapping, request);
- }
-
- @Override
- public String toString() {
- StringBuffer s = new StringBuffer(super.toString());
- s.append("ad=" + ad + " ");
- s.append("psa=" + psa + " ");
- s.append("psp=" + psp + " ");
-
- s.append("availableUsers={");
- listToString(s, availableUsers);
- s.append("} ");
-
- s.append("pendingUsers={");
- listToString(s, pendingUsers);
- s.append("}");
-
- return s.toString();
- }
-
- private void listToString(StringBuffer s, Integer[] l) {
- if (l != null) {
- for (int i = 0; i < l.length; i++) {
- s.append(l[i]);
- if (i < (l.length - 1)) {
- s.append(", ");
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersFormPrepareAction.java
deleted file mode 100644
index 86eef34..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/AddUsersFormPrepareAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.tiles.ComponentContext;
-import org.apache.struts.tiles.actions.TilesAction;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.legacy.Constants;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-import org.rhq.enterprise.gui.legacy.util.SessionUtils;
-import org.rhq.enterprise.gui.util.WebUtility;
-import org.rhq.enterprise.server.auth.SubjectManagerLocal;
-import org.rhq.enterprise.server.authz.RoleManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * An Action that retrieves data from the BizApp to facilitate display of the form to add users to AlertDefinition.
- */
-public class AddUsersFormPrepareAction extends TilesAction {
- private Log log = LogFactory.getLog(AddUsersFormPrepareAction.class);
-
- @Override
- @SuppressWarnings("deprecation")
- public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) throws Exception {
- AddUsersForm addForm = (AddUsersForm) form;
- Subject subject = RequestUtils.getSubject(request);
-
- PageControl pcp = WebUtility.getPageControl(request, "p");
- PageControl pca = WebUtility.getPageControl(request, "a");
-
- log.trace("available page control: " + pca);
- log.trace("pending page control: " + pcp);
-
- SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
- RoleManagerLocal roleManager = LookupUtil.getRoleManager();
-
- /*
- * pending users are those on the right side of the "add to list" widget - awaiting association with the Alert
- * Definition when the form's "ok" button is clicked.
- */
- Integer[] pendingIds = SessionUtils.getList(request.getSession(), Constants.PENDING_USERS_SES_ATTR);
-
- log.trace("getting pending users for alert definition [" + addForm.getAd() + "]");
- PageList<Subject> pendingUsers = subjectManager.findSubjectsById(pendingIds, pcp);
- request.setAttribute(Constants.PENDING_USERS_ATTR, pendingUsers);
-
- /*
- * available users are all users in the system that are _not_ associated with the definition and are not pending
- */
- log.trace("getting available users for alert definition [" + addForm.getAd() + "]");
- PageList<Subject> availableUsers = subjectManager.findAvailableSubjectsForAlertDefinition(subject, addForm
- .getAd(), pendingIds, pca);
- request.setAttribute(Constants.AVAIL_USERS_ATTR, availableUsers);
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionAction.java
deleted file mode 100644
index a65aec2..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionAction.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.rhq.enterprise.gui.legacy.Constants;
-import org.rhq.enterprise.gui.legacy.action.BaseAction;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-
-/**
- * Create a new alert definition.
- */
-public class EditDefinitionSyslogActionAction extends BaseAction {
- private Log log = LogFactory.getLog(EditDefinitionSyslogActionAction.class.getName());
-
- // ---------------------------------------------------- Public Methods
-
- @Override
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- SyslogActionForm saForm = (SyslogActionForm) form;
-
- ServletContext ctx = getServlet().getServletContext();
- int sessionID = RequestUtils.getSessionId(request).intValue();
- Integer rid = saForm.getRid();
- // Integer type = saForm.getType();
- // EventsBoss eb = ContextUtils.getEventsBoss(ctx);
-
- Map params = new HashMap();
- params.put(Constants.RESOURCE_PARAM, rid);
- // params.put(Constants.RESOURCE_TYPE_ID_PARAM, type);
- params.put("ad", saForm.getAd());
-
- ActionForward forward = checkSubmit(request, mapping, form, params);
- if (forward != null) {
- log.trace("returning " + forward);
- return forward;
- }
-
- // AlertDefinition alertDef = eb.getAlertDefinition( sessionID, saForm.getAd() );
- // Action action = AlertDefUtil.getSyslogActionValue(alertDef);
- // if ( saForm.getShouldBeRemoved() ) {
- // if (null != action) {
- // alertDef.removeAction(action);
- // eb.updateAlertDefinition(sessionID, alertDef);
- // }
- // } else {
- // SyslogActionConfig sa = new SyslogActionConfig();
- // sa.setMeta( saForm.getMetaProject() );
- // sa.setProduct( saForm.getProject() );
- // sa.setVersion( saForm.getVersion() );
- // ConfigResponse configResponse = sa.getConfigResponse();
- // if (null == action) {
- // eb.createAction( sessionID, saForm.getAd(),
- // sa.getImplementor(), configResponse );
- // } else {
- // action.setConfig( configResponse.encode() );
- // eb.updateAction(sessionID, action);
- // }
- // }
-
- return returnSuccess(request, mapping, params);
- }
-}
-
-// EOF
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionFormPrepareAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionFormPrepareAction.java
deleted file mode 100644
index d8d1d66..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/EditDefinitionSyslogActionFormPrepareAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.tiles.ComponentContext;
-import org.apache.struts.tiles.actions.TilesAction;
-
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
-
-/**
- * An Action that retrieves data from the BizApp to facilitate display of the <em>Edit Alert Definition Syslog
- * Action</em> form.
- */
-public class EditDefinitionSyslogActionFormPrepareAction extends TilesAction {
- protected Log log = LogFactory.getLog(EditDefinitionSyslogActionFormPrepareAction.class.getName());
-
- // ---------------------------------------------------- Public Methods
-
- @Override
- public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) throws Exception {
- SyslogActionForm saForm = (SyslogActionForm) form;
-
- // properties
- AlertDefinition alertDef = AlertDefUtil.getAlertDefinition(request);
- //AlertDefUtil.prepareSyslogActionForm(alertDef, saForm);
-
- return null;
- }
-}
-
-// EOF
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
index 07bcc1e..d35ed67 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/PortalAction.java
@@ -67,13 +67,7 @@ public class PortalAction extends ResourceController {
keyMethodMap.setProperty("editProperties", "editDefinitionProperties");
keyMethodMap.setProperty("editConditions", "editDefinitionConditions");
keyMethodMap.setProperty("editControlAction", "editDefinitionControlAction");
- keyMethodMap.setProperty("editSyslogAction", "editDefinitionSyslogAction");
- keyMethodMap.setProperty("viewRoles", "viewDefinitionRoles");
- keyMethodMap.setProperty("viewUsers", "viewDefinitionUsers");
-
- keyMethodMap.setProperty("addRoles", "addRolesDefinitions");
- keyMethodMap.setProperty("addUsers", "addUsersDefinitions");
}
@Override
@@ -173,44 +167,6 @@ public class PortalAction extends ResourceController {
return null;
}
- public ActionForward editDefinitionSyslogAction(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- setResource(request);
- Portal portal = Portal.createPortal();
- setTitle(request, portal, "alerts.config.platform.EditSyslogAction.Title");
- portal.addPortlet(new Portlet(".events.config.edit.syslogaction"), 1);
- portal.setDialog(true);
- request.setAttribute(Constants.PORTAL_KEY, portal);
-
- return null;
- }
-
- public ActionForward viewDefinitionRoles(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- setResource(request);
- Portal portal = Portal.createPortal();
- setTitle(request, portal, "alert.config.platform.props.ViewDef.roles.Title");
- portal.addPortlet(new Portlet(".events.config.view.roles"), 1);
-
- // JW - this shouldn't be a dialog ... portal.setDialog(true);
- request.setAttribute(Constants.PORTAL_KEY, portal);
-
- return null;
- }
-
- public ActionForward viewDefinitionUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- setResource(request);
- Portal portal = Portal.createPortal();
- setTitle(request, portal, "alert.config.platform.props.ViewDef.users.Title");
- portal.addPortlet(new Portlet(".events.config.view.users"), 1);
-
- // JW - this shouldn't be a dialog ... portal.setDialog(true);
- request.setAttribute(Constants.PORTAL_KEY, portal);
-
- return null;
- }
-
public ActionForward monitorConfigureAlerts(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
@@ -258,30 +214,6 @@ public class PortalAction extends ResourceController {
return null;
}
- public ActionForward addUsersDefinitions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- setResource(request);
- Portal portal = Portal.createPortal();
- setTitle(request, portal, "alerts.config.platform.AssignUsersToAlertDefinition.Title");
- portal.addPortlet(new Portlet(".events.config.addusers"), 1);
- portal.setDialog(false);
-
- request.setAttribute(Constants.PORTAL_KEY, portal);
- return null;
- }
-
- public ActionForward addRolesDefinitions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- setResource(request);
- Portal portal = Portal.createPortal();
- setTitle(request, portal, "alerts.config.platform.AssignRolesToAlertDefinition.Title");
- portal.addPortlet(new Portlet(".events.config.addroles"), 1);
- portal.setDialog(false);
-
- request.setAttribute(Constants.PORTAL_KEY, portal);
- return null;
- }
-
/**
* This sets the return path for a ResourceAction by appending the type and resource id to the forward url.
*
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/SyslogActionForm.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/SyslogActionForm.java
deleted file mode 100644
index 19fbb93..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/SyslogActionForm.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.validator.GenericValidator;
-import org.apache.struts.action.ActionErrors;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.ActionMessage;
-import org.rhq.enterprise.gui.legacy.action.resource.ResourceForm;
-import org.rhq.enterprise.gui.legacy.util.RequestUtils;
-
-/**
- * Form for editing the control action for an alert definition.
- */
-public final class SyslogActionForm extends ResourceForm {
- private Log log = LogFactory.getLog(SyslogActionForm.class.getName());
-
- //-------------------------------------instance variables
-
- // control action properties
- private Integer id; // nullable
- private Integer ad; // nullable
- private String metaProject;
- private String project;
- private String version;
- private boolean shouldBeRemoved;
-
- //-------------------------------------constructors
-
- public SyslogActionForm() {
- // do nothing
- }
-
- //-------------------------------------public methods
-
- public Integer getId() {
- return this.id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public Integer getAd() {
- return this.ad;
- }
-
- public void setAd(Integer ad) {
- this.ad = ad;
- }
-
- public String getMetaProject() {
- return this.metaProject;
- }
-
- public void setMetaProject(String metaProject) {
- this.metaProject = metaProject;
- }
-
- public String getProject() {
- return this.project;
- }
-
- public void setProject(String project) {
- this.project = project;
- }
-
- public String getVersion() {
- return this.version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean getShouldBeRemoved() {
- return this.shouldBeRemoved;
- }
-
- public void setShouldBeRemoved(boolean shouldBeRemoved) {
- this.shouldBeRemoved = shouldBeRemoved;
- }
-
- public void reset(ActionMapping mapping, HttpServletRequest request) {
- super.reset(mapping, request);
- metaProject = null;
- project = null;
- version = null;
- shouldBeRemoved = false;
- }
-
- public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
- // don't validate if we are preparing the form ...
- if (shouldValidate(mapping, request)) {
- ActionErrors errs = super.validate(mapping, request);
- if (null == errs) {
- errs = new ActionErrors();
- }
-
- // if we are not removing the action, all the fields are
- // required
- if (!getShouldBeRemoved()) {
- if (GenericValidator.isBlankOrNull(getMetaProject())) {
- String fieldName = RequestUtils.message(request, "alert.config.props.Syslog.MetaProject");
- ActionMessage err = new ActionMessage("errors.required", fieldName);
- errs.add("metaProject", err);
- }
-
- if (GenericValidator.isBlankOrNull(getProject())) {
- String fieldName = RequestUtils.message(request, "alert.config.props.Syslog.Project");
- ActionMessage err = new ActionMessage("errors.required", fieldName);
- errs.add("project", err);
- }
-
- if (GenericValidator.isBlankOrNull(getVersion())) {
- String fieldName = RequestUtils.message(request, "alert.config.props.Syslog.Version");
- ActionMessage err = new ActionMessage("errors.required", fieldName);
- errs.add("version", err);
- }
- }
-
- return errs;
- } else {
- return null;
- }
- }
-}
-
-// EOF
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsRolesAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsRolesAction.java
deleted file mode 100644
index 0cca221..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsRolesAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.alert.notification.RoleNotification;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-public class ViewDefinitionNotificationsRolesAction extends ViewDefinitionNotificationsAction<RoleNotification> {
- private Log log = LogFactory.getLog(ViewDefinitionNotificationsRolesAction.class);
-
- @Override
- protected PageList<RoleNotification> getPageList(Subject subject, AlertDefinition alertDefinition,
- PageControl pageControl) {
- AlertNotificationManagerLocal alertNotificationManager = LookupUtil.getAlertNotificationManager();
- PageList<RoleNotification> notifications = alertNotificationManager.getRoleNotifications(alertDefinition
- .getId(), pageControl);
-
- return notifications;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsUsersAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsUsersAction.java
deleted file mode 100644
index 39e00de..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionNotificationsUsersAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-public class ViewDefinitionNotificationsUsersAction extends ViewDefinitionNotificationsAction<SubjectNotification> {
- private Log log = LogFactory.getLog(ViewDefinitionNotificationsUsersAction.class);
-
- @Override
- protected PageList<SubjectNotification> getPageList(Subject subject, AlertDefinition alertDefinition,
- PageControl pageControl) {
- AlertNotificationManagerLocal alertNotificationManager = LookupUtil.getAlertNotificationManager();
- PageList<SubjectNotification> notifications = alertNotificationManager.getSubjectNotifications(alertDefinition
- .getId(), pageControl);
-
- return notifications;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionAction.java
deleted file mode 100644
index 4291c80..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.gui.legacy.action.resource.common.monitor.alerts.config;
-
-import java.util.Properties;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.apache.struts.tiles.actions.TilesAction;
-
-import org.rhq.core.domain.alert.AlertDefinition;
-import org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.AlertDefUtil;
-import org.rhq.enterprise.server.RHQConstants;
-import org.rhq.enterprise.server.util.LookupUtil;
-
-/**
- * View an alert definition -- syslog action.
- */
-public class ViewDefinitionSyslogActionAction extends TilesAction {
- private Log log = LogFactory.getLog(ViewDefinitionSyslogActionAction.class.getName());
-
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- Properties config = LookupUtil.getSystemManager().getSystemConfiguration();
-
- String enabledStr = config.getProperty(RHQConstants.SyslogActionsEnabled);
- Boolean syslogActionsEnabled = Boolean.valueOf(enabledStr);
- request.setAttribute(RHQConstants.SyslogActionsEnabled, syslogActionsEnabled);
-
- if (syslogActionsEnabled) {
- AlertDefinition alertDef = AlertDefUtil.getAlertDefinition(request);
- SyslogActionForm saForm = new SyslogActionForm();
- //AlertDefUtil.prepareSyslogActionForm(alertDef, saForm);
- request.setAttribute("syslogActionForm", saForm);
- }
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
index c7466d1..8392074 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/struts-config.xml
@@ -181,15 +181,6 @@
<form-bean name="EditAlertDefinitionControlActionForm"
type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ControlActionForm"/>
- <form-bean name="EditAlertDefinitionSyslogActionForm"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.SyslogActionForm"/>
-
- <form-bean name="AddAlertUsersForm"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.AddUsersForm"/>
-
- <form-bean name="AddAlertRolesForm"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.AddRolesForm"/>
-
<form-bean name="EditMetricBaselineForm"
type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.EditMetricBaselineForm"/>
@@ -2578,42 +2569,6 @@
scope="request"
type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ViewDefinitionControlActionAction"/>
- <action path="/alerts/ViewSyslogAction"
- scope="request"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ViewDefinitionSyslogActionAction"/>
-
- <action path="/alerts/ViewNotificationsRoles"
- name="RemoveNotificationsForm"
- scope="request"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ViewDefinitionNotificationsRolesAction">
- <set-property property="title" value="View+Alert+Detail"/>
- </action>
-
- <action path="/alerts/ViewNotificationsUsers"
- name="RemoveNotificationsForm"
- scope="request"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.ViewDefinitionNotificationsUsersAction">
- <set-property property="title" value="View+Alert+Detail"/>
- </action>
-
- <action path="/alerts/RemoveRoles"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.RemoveRolesAction"
- name="RemoveNotificationsForm"
- scope="request"
- input="/alerts/Config.do?mode=viewRoles">
- <forward name="success" path="/alerts/Config.do?mode=viewRoles" redirect="true"/>
- <forward name="failure" path="/alerts/Config.do?mode=viewRoles" redirect="true"/>
- </action>
-
- <action path="/alerts/RemoveUsers"
- type="org.rhq.enterprise.gui.legacy.action.resource.common.monitor.alerts.config.RemoveUsersAction"
- name="RemoveNotificationsForm"
- scope="request"
- input="/alerts/Config.do?mode=viewUsers">
- <forward name="success" path="/alerts/Config.do?mode=viewUsers" redirect="true"/>
- <forward name="failure" path="/alerts/Config.do?mode=viewUsers" redirect="true"/>
- </action>
-
<!-- JBNADM-536 update for name and title property-->
<action path="/software/ListSoftware"
name="RemoveAlertsForm"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tiles/events-def.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tiles/events-def.xml
index 38238f5..53e1545 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tiles/events-def.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/tiles/events-def.xml
@@ -106,25 +106,11 @@
<definition name=".events.alert.view.notifications.list"
path="/resource/common/monitor/alerts/ViewAlertNotificationsList.jsp"/>
- <definition name=".events.alert.view.notifications.others"
- path="/resource/common/monitor/alerts/ViewAlertNotificationsOthers.jsp"
- controllerUrl="/alerts/ViewNotificationsOthers.do"/>
-
- <definition name=".events.alert.view.notifications.roles"
- path="/resource/common/monitor/alerts/ViewAlertNotificationsRoles.jsp"
- controllerUrl="/alerts/ViewNotificationsRoles.do"/>
-
- <definition name=".events.alert.view.notifications.users"
- path="/resource/common/monitor/alerts/ViewAlertNotificationsUsers.jsp"
- controllerUrl="/alerts/ViewNotificationsUsers.do"/>
<definition name=".events.alert.view.controlaction"
path="/resource/common/monitor/alerts/config/ViewDefinitionControlAction.jsp"
controllerUrl="/alerts/ViewControlAction.do"/>
- <definition name=".events.alert.view.syslogaction"
- path="/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp"
- controllerUrl="/alerts/ViewSyslogAction.do"/>
<definition name=".events.alert.view"
path="/resource/common/monitor/alerts/ViewAlert.jsp"
@@ -216,18 +202,6 @@
<definition name=".events.config.view.notifications.tabs"
path="/resource/common/monitor/alerts/config/ViewDefinitionNotificationsTabs.jsp"/>
- <definition name=".events.config.view.notifications.others"
- path="/resource/common/monitor/alerts/config/ListOthers.jsp"
- controllerUrl="/alerts/ViewNotificationsOthers.do"/>
-
- <definition name=".events.config.view.notifications.roles"
- path="/resource/common/monitor/alerts/config/ListRoles.jsp"
- controllerUrl="/alerts/ViewNotificationsRoles.do"/>
-
- <definition name=".events.config.view.notifications.users"
- path="/resource/common/monitor/alerts/config/ListUsers.jsp"
- controllerUrl="/alerts/ViewNotificationsUsers.do"/>
-
<definition name=".events.config.view.controlactionbox"
path="/resource/common/monitor/alerts/config/ViewDefinitionControlActionBox.jsp"
controllerUrl="/alerts/ViewControlAction.do"/>
@@ -235,13 +209,6 @@
<definition name=".events.config.view.controlaction"
path="/resource/common/monitor/alerts/config/ViewDefinitionControlAction.jsp"/>
- <definition name=".events.config.view.syslogactionbox"
- path="/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionBox.jsp"
- controllerUrl="/alerts/ViewSyslogAction.do"/>
-
- <definition name=".events.config.view.syslogaction"
- path="/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp"/>
-
<definition name=".events.config.view.others"
path="/resource/common/monitor/alerts/config/ViewDefinition.jsp"
controllerUrl="/alerts/ViewDefinition.do"/>
@@ -259,18 +226,6 @@
path="/resource/common/monitor/alerts/config/ListDefinitions.jsp"
controllerUrl="/alerts/ListDefinitions.do"/>
- <definition name =".events.config.addusers"
- controllerUrl="/events/config/AddUsersFormPrepare.do"
- path="/resource/common/monitor/alerts/config/AddEventUsers.jsp"/>
-
- <definition name =".events.config.addroles"
- controllerUrl="/events/config/AddRolesFormPrepare.do"
- path="/resource/common/monitor/alerts/config/AddEventRoles.jsp"/>
-
- <definition name =".events.config.addothers"
- controllerUrl="/events/config/AddOthersFormPrepare.do"
- path="/resource/common/monitor/alerts/config/AddEventOthers.jsp"/>
-
<definition name=".tabs.resource.events"
extends=".tabs.resource">
<putList name="tabList">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventRoles.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventRoles.jsp
deleted file mode 100644
index 5fa4f6a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventRoles.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
-
-<%-- if the attributes are not available, we can't display this tile: an error probably occured --%>
-<c:choose>
-<c:when test="${AvailableRoles == null}">
-<!-- error occured -->
-<tiles:insert page="/common/NoRights.jsp"/>
-</c:when>
-<c:otherwise>
-
-<html:form method="POST" action="/alerts/config/AddRoles">
-
-<tiles:insert definition=".page.title.events">
- <tiles:put name="titleKey" value="alert.config.edit.AddNotifications"/>
-</tiles:insert>
-
-<tiles:insert definition=".portlet.error"/>
-
-<tiles:insert page="/resource/common/monitor/alerts/config/DefinitionRolesForm.jsp">
- <tiles:put name="availableRoles" beanName="AvailableRoles"/>
- <tiles:put name="numAvailableRoles" beanName="AvailableRoles" beanProperty="totalSize"/>
- <tiles:put name="pendingRoles" beanName="PendingRoles"/>
- <tiles:put name="numPendingRoles" beanName="PendingRoles" beanProperty="totalSize"/>
-</tiles:insert>
-
-<tiles:insert definition=".form.buttons">
- <tiles:put name="addToList" value="true"/>
-</tiles:insert>
-
-<tiles:insert definition=".page.footer"/>
-<html:hidden property="ad"/>
-<html:hidden property="id"/>
-<html:hidden property="type"/>
-<html:hidden property="groupId"/>
-
-</html:form>
-
-</c:otherwise>
-</c:choose>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventUsers.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventUsers.jsp
deleted file mode 100644
index 9f49cf9..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/AddEventUsers.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
-
-<%-- if the attributes are not available, we can't display this tile: an error probably occured --%>
-<c:choose>
-<c:when test="${AvailableUsers == null}">
-<!-- error occured -->
-<tiles:insert page="/common/NoRights.jsp"/>
-</c:when>
-<c:otherwise>
-
-<html:form method="POST" action="/alerts/config/AddUsers">
-
-<tiles:insert definition=".page.title.events">
- <tiles:put name="titleKey" value="alert.config.edit.AddNotifications"/>
-</tiles:insert>
-
-<tiles:insert definition=".portlet.error"/>
-
-<tiles:insert page="/resource/common/monitor/alerts/config/DefinitionUsersForm.jsp">
- <tiles:put name="availableUsers" beanName="AvailableUsers"/>
- <tiles:put name="numAvailableUsers" beanName="AvailableUsers" beanProperty="totalSize"/>
- <tiles:put name="pendingUsers" beanName="PendingUsers"/>
- <tiles:put name="numPendingUsers" beanName="PendingUsers" beanProperty="totalSize"/>
-</tiles:insert>
-
-<tiles:insert definition=".form.buttons">
- <tiles:put name="addToList" value="true"/>
-</tiles:insert>
-
-<tiles:insert definition=".page.footer"/>
-<html:hidden property="ad"/>
-<html:hidden property="id"/>
-<html:hidden property="type"/>
-<html:hidden property="groupId"/>
-
-</html:form>
-
-</c:otherwise>
-</c:choose>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListRoles.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListRoles.jsp
deleted file mode 100644
index e1b5ccc..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListRoles.jsp
+++ /dev/null
@@ -1,27 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="/WEB-INF/tld/hq.tld" prefix="hq" %>
-<%@ taglib uri="/WEB-INF/tld/display.tld" prefix="display" %>
-
-<tiles:importAttribute name="selfUrl"/>
-
-<%-- if the attributes are not available, we can't display this tile: an error probably occured --%>
-<c:choose>
-<c:when test="${null == notifyList || empty listSize}">
-<!-- error occured -->
-</c:when>
-<c:otherwise>
-
-<hq:pageSize var="pageSize"/>
-<display:table cellspacing="0" cellpadding="0" width="100%" action="${selfUrl}" items="${notifyList}">
- <display:column width="1%" property="id" title="<input type=\"checkbox\" onclick=\"ToggleAll(this, widgetProperties, true)\" name=\"listToggleAll\">" isLocalizedTitle="false" styleClass="ListCellCheckbox" headerStyleClass="ListHeaderCheckbox">
- <display:checkboxdecorator name="roles" onclick="ToggleSelection(this,widgetProperties, true)" styleClass="listMember"/>
- </display:column>
- <display:column width="20%" property="role.name" title="alert.config.props.NB.Name" href="/admin/role/RoleAdmin.do?mode=view" paramId="r" paramProperty="role.id"/>
- <display:column width="79%" property="role.description" title="common.header.Description"/>
-</display:table>
-
-</c:otherwise>
-</c:choose>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListUsers.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListUsers.jsp
deleted file mode 100644
index 12af63f..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ListUsers.jsp
+++ /dev/null
@@ -1,30 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="/WEB-INF/tld/hq.tld" prefix="hq" %>
-<%@ taglib uri="/WEB-INF/tld/display.tld" prefix="display" %>
-
-<tiles:importAttribute name="selfUrl"/>
-
-<%-- if the attributes are not available, we can't display this tile: an error probably occured --%>
-<c:choose>
-<c:when test="${null == notifyList || empty listSize}">
-<!-- error occured -->
-</c:when>
-<c:otherwise>
-
-<hq:pageSize var="pageSize"/>
-<display:table cellspacing="0" cellpadding="0" width="100%" action="${selfUrl}" items="${notifyList}">
- <display:column width="1%" property="id" title="<input type=\"checkbox\" onclick=\"ToggleAll(this, widgetProperties, true)\" name=\"listToggleAll\">" isLocalizedTitle="false" styleClass="ListCellCheckbox" headerStyleClass="ListHeaderCheckbox">
- <display:checkboxdecorator name="users" onclick="ToggleSelection(this, widgetProperties, true)" styleClass="listMember"/>
- </display:column>
- <display:column width="15%" property="subject.firstName" title="alert.config.props.NB.FirstName"/>
- <display:column width="15%" property="subject.lastName" title="alert.config.props.NB.LastName"/>
- <display:column width="20%" property="subject.name" title="alert.config.props.NB.Username" href="/admin/user/UserAdmin.do?mode=view" paramId="u" paramProperty="subject.id"/>
- <display:column width="29%" property="subject.emailAddress" title="alert.config.props.NB.Email" autolink="true"/>
- <display:column width="20%" property="subject.department" title="alert.config.props.NB.Dept"/>
-</display:table>
-
-</c:otherwise>
-</c:choose>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinition.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinition.jsp
index b8494f6..3032dee 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinition.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinition.jsp
@@ -22,8 +22,6 @@
<tiles:insert definition=".events.config.view.controlactionbox"/>
-<tiles:insert definition=".events.config.view.syslogactionbox"/>
-
<tiles:insert definition=".events.config.view.nav"/>
<a href="/rhq/resource/alert/notif/listAlertSender.xhtml?id=${param.id}&ad=${param.ad}">To Alert sender plugins</a>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionNotifications.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionNotifications.jsp
index f38473f..4f8688e 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionNotifications.jsp
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionNotifications.jsp
@@ -6,55 +6,6 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/hq.tld" prefix="hq" %>
-<c:url var="viewRolesUrl" value="/alerts/Config.do">
- <c:param name="mode" value="viewRoles"/>
- <c:choose>
- <c:when test="${not empty Resource}">
- <c:param name="id" value="${Resource.id}"/>
- </c:when>
- <c:when test="${not empty ResourceGroup}">
- <c:param name="groupId" value="${ResourceGroup.id}"/>
- </c:when>
- <c:otherwise>
- <c:param name="type" value="${ResourceType.id}"/>
- </c:otherwise>
- </c:choose>
- <c:param name="ad" value="${alertDef.id}"/>
-</c:url>
-
-
-<c:url var="viewUsersUrl" value="/alerts/Config.do">
- <c:param name="mode" value="viewUsers"/>
- <c:choose>
- <c:when test="${not empty Resource}">
- <c:param name="id" value="${Resource.id}"/>
- </c:when>
- <c:when test="${not empty ResourceGroup}">
- <c:param name="groupId" value="${ResourceGroup.id}"/>
- </c:when>
- <c:otherwise>
- <c:param name="type" value="${ResourceType.id}"/>
- </c:otherwise>
- </c:choose>
- <c:param name="ad" value="${alertDef.id}"/>
-</c:url>
-
-
-<c:url var="viewOthersUrl" value="/alerts/Config.do">
- <c:param name="mode" value="viewOthers"/>
- <c:choose>
- <c:when test="${not empty Resource}">
- <c:param name="id" value="${Resource.id}"/>
- </c:when>
- <c:when test="${not empty ResourceGroup}">
- <c:param name="groupId" value="${ResourceGroup.id}"/>
- </c:when>
- <c:otherwise>
- <c:param name="type" value="${ResourceType.id}"/>
- </c:otherwise>
- </c:choose>
- <c:param name="ad" value="${alertDef.id}"/>
-</c:url>
<tiles:insert definition=".events.config.view.notifications.tabs">
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp
deleted file mode 100644
index 093eb87..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogAction.jsp
+++ /dev/null
@@ -1,45 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-
-<c:if test="${CAM_SYSLOG_ACTIONS_ENABLED}">
-<tiles:insert definition=".header.tab">
- <tiles:put name="tabKey" value="alert.config.props.Syslog.Title"/>
-</tiles:insert>
-
-<table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td colspan="2" class="BlockContent"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
- <c:choose>
- <c:when test="${(! empty syslogActionForm.id) and (syslogActionForm.id > 0)}">
- <tr valign="top">
- <td width="20%" class="BlockLabel"><fmt:message key="alert.config.props.Syslog.MetaProject"/>:</td>
- <td width="80%" class="BlockContent"><c:out value="${syslogActionForm.metaProject}"/></td>
- </tr>
- <tr valign="top">
- <td width="20%" class="BlockLabel"><fmt:message key="alert.config.props.Syslog.Project"/>:</td>
- <td width="80%" class="BlockContent"><c:out value="${syslogActionForm.project}"/></td>
- </tr>
- <tr valign="top">
- <td width="20%" class="BlockLabel"><fmt:message key="alert.config.props.Syslog.Version"/>:</td>
- <td width="80%" class="BlockContent"><c:out value="${syslogActionForm.version}"/></td>
- </tr>
- </c:when>
- <c:otherwise>
- <tr valign="top">
- <td colspan="2" class="BlockContent"><fmt:message key="alert.config.props.Syslog.NoSyslogAction"/></td>
- </tr>
- </c:otherwise>
- </c:choose>
- <tr>
- <td colspan="2" class="BlockContent"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
- <tr>
- <td colspan="2" class="BlockBottomLine"><html:img page="/images/spacer.gif" width="1" height="1" border="0"/></td>
- </tr>
-</table>
-</c:if>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionBox.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionBox.jsp
deleted file mode 100644
index 2f65aad..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/resource/common/monitor/alerts/config/ViewDefinitionSyslogActionBox.jsp
+++ /dev/null
@@ -1,13 +0,0 @@
-<%@ page language="java" %>
-<%@ page errorPage="/common/Error.jsp" %>
-<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-
-<c:if test="${CAM_SYSLOG_ACTIONS_ENABLED}">
-<tiles:insert definition=".events.config.view.syslogaction"/>
-
-<tiles:insert definition=".toolbar.edit">
- <tiles:put name="editUrl"><c:out value="/alerts/Config.do?mode=editSyslogAction&type=${Resource.entityId.type}&rid=${Resource.id}&ad=${alertDef.id}"/></tiles:put>
-</tiles:insert>
-<br>
-</c:if>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
index 8bec831..8eee581 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java
@@ -56,8 +56,6 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.AlertPriority;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.AlertNotificationLog;
-import org.rhq.core.domain.alert.notification.RoleNotification;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.AlertCriteria;
@@ -627,34 +625,12 @@ public class AlertManagerBean implements AlertManagerLocal, AlertManagerRemote {
Set<String> emailAddresses = new LinkedHashSet<String>();
for (AlertNotification alertNotification : alertNotifications) {
- if (alertNotification instanceof RoleNotification) {
- RoleNotification roleNotification = (RoleNotification) alertNotification;
- Set<Subject> subjects = roleNotification.getRole().getSubjects();
-
- for (Subject subject : subjects) {
- if (subject.getFsystem()) {
- /*
- * if a user wants to notify the superuser role, that's fine... but we shouldn't send an
- * email to the special overlord user
- */
- continue;
- }
-
- String emailAddress = subject.getEmailAddress();
-
- processEmailAddress(alert, emailAddress, emailAddresses);
- }
- } else if (alertNotification instanceof SubjectNotification) {
- SubjectNotification subjectNotification = (SubjectNotification) alertNotification;
- String emailAddress = subjectNotification.getSubject().getEmailAddress();
- processEmailAddress(alert, emailAddress, emailAddresses);
- }
-
-
- // Send over the new AlertSenders
- if (alertNotification.getSenderName()==null)
+ // Send over the new AlertSender plugins
+ if (alertNotification.getSenderName()==null) {
+ log.warn("Alert notification " + alertNotification + " has no sender name defined");
continue;
+ }
AlertSender sender = getAlertSender(alertNotification);
if (sender != null) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
index 08cbe40..dfa59f3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
@@ -20,8 +20,6 @@ package org.rhq.enterprise.server.alert;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -41,17 +39,12 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.AlertDefinitionContext;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.NotificationTemplate;
-import org.rhq.core.domain.alert.notification.RoleNotification;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.plugin.PluginKey;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PersistenceUtility;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
@@ -137,176 +130,11 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
alertDefinition.getResource().getId());
}
- if (hasPermission == false) {
+ if (!hasPermission) {
throw new PermissionException(subject + " is not authorized to edit this alert definition");
}
}
- public int addRoleNotifications(Subject subject, Integer alertDefinitionId, Integer[] roleIds) {
- AlertDefinition alertDefinition = getDetachedAlertDefinition(alertDefinitionId);
- Collection<AlertNotification> notifications = alertDefinition.getAlertNotifications();
-
- List<Role> roles = roleManager.findRolesByIds(roleIds, PageControl.getUnlimitedInstance());
-
- int added = 0;
- for (Role role : roles) {
- RoleNotification notification = new RoleNotification(alertDefinition, role);
-
- // only increment for non-duplicate additions
- if (notifications.contains(notification) == false) {
- added++;
- notifications.add(notification); // cascading should take care of persisting
- }
- }
-
- postProcessAlertDefinition(alertDefinition);
-
- return added;
- }
-
- @SuppressWarnings("unchecked")
- public PageList<RoleNotification> getRoleNotifications(Integer alertDefinitionId, PageControl pageControl) {
- pageControl.initDefaultOrderingField("rn.role.name");
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager,
- RoleNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- RoleNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID, pageControl);
-
- queryCount.setParameter("alertDefinitionId", alertDefinitionId);
- query.setParameter("alertDefinitionId", alertDefinitionId);
-
- long count = (Long) queryCount.getSingleResult();
- List<RoleNotification> results = query.getResultList();
-
- return new PageList<RoleNotification>(results, (int) count, pageControl);
- }
-
- @SuppressWarnings("unchecked")
- public PageList<RoleNotification> getRoleNotifications(Integer[] alertNotificationIds, PageControl pageControl) {
- pageControl.initDefaultOrderingField("rn.role.name");
-
- if ((alertNotificationIds == null) || (alertNotificationIds.length == 0)) {
- return new PageList<RoleNotification>(Collections.EMPTY_LIST, 0, pageControl);
- }
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager, RoleNotification.QUERY_FIND_BY_IDS);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, RoleNotification.QUERY_FIND_BY_IDS,
- pageControl);
-
- queryCount.setParameter("ids", alertNotificationIds);
- query.setParameter("ids", alertNotificationIds);
-
- long count = (Long) queryCount.getSingleResult();
- List<RoleNotification> results = query.getResultList();
-
- return new PageList<RoleNotification>(results, (int) count, pageControl);
- }
-
- @SuppressWarnings("unchecked")
- public PageList<RoleNotification> getRoleNotificationsByRoles(Integer[] roleIds, PageControl pageControl) {
- pageControl.initDefaultOrderingField("rn.role.name");
-
- if ((roleIds == null) || (roleIds.length == 0)) {
- return new PageList<RoleNotification>(Collections.EMPTY_LIST, 0, pageControl);
- }
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager, RoleNotification.QUERY_FIND_BY_ROLE_IDS);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, RoleNotification.QUERY_FIND_BY_ROLE_IDS,
- pageControl);
-
- queryCount.setParameter("ids", roleIds);
- query.setParameter("ids", roleIds);
-
- long count = (Long) queryCount.getSingleResult();
- List<RoleNotification> results = query.getResultList();
-
- return new PageList<RoleNotification>(results, (int) count, pageControl);
- }
-
- public int addSubjectNotifications(Subject user, Integer alertDefinitionId, Integer[] subjectIds) {
- AlertDefinition alertDefinition = getDetachedAlertDefinition(alertDefinitionId);
- Collection<AlertNotification> notifications = alertDefinition.getAlertNotifications();
-
- List<Subject> subjects = subjectManager.findSubjectsById(subjectIds, PageControl.getUnlimitedInstance());
-
- int added = 0;
- for (Subject subject : subjects) {
- SubjectNotification notification = new SubjectNotification(alertDefinition, subject);
-
- // only increment for non-duplicate additions
- if (notifications.contains(notification) == false) {
- added++;
- notifications.add(notification); // cascading should take care of persisting
- }
- }
-
- postProcessAlertDefinition(alertDefinition);
-
- return added;
- }
-
- @SuppressWarnings("unchecked")
- public PageList<SubjectNotification> getSubjectNotifications(Integer alertDefinitionId, PageControl pageControl) {
- pageControl.initDefaultOrderingField("sn.subject.name");
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager,
- SubjectNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- SubjectNotification.QUERY_FIND_ALL_BY_ALERT_DEFINITION_ID, pageControl);
-
- queryCount.setParameter("alertDefinitionId", alertDefinitionId);
- query.setParameter("alertDefinitionId", alertDefinitionId);
-
- long count = (Long) queryCount.getSingleResult();
- List<SubjectNotification> results = query.getResultList();
-
- return new PageList<SubjectNotification>(results, (int) count, pageControl);
- }
-
-
- @SuppressWarnings("unchecked")
- public PageList<SubjectNotification> getSubjectNotifications(Integer[] alertNotificationIds, PageControl pageControl) {
- pageControl.initDefaultOrderingField("sn.subject.name");
-
- if ((alertNotificationIds == null) || (alertNotificationIds.length == 0)) {
- return new PageList<SubjectNotification>(Collections.EMPTY_LIST, 0, pageControl);
- }
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager, SubjectNotification.QUERY_FIND_BY_IDS);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, SubjectNotification.QUERY_FIND_BY_IDS,
- pageControl);
-
- queryCount.setParameter("ids", alertNotificationIds);
- query.setParameter("ids", alertNotificationIds);
-
- long count = (Long) queryCount.getSingleResult();
- List<SubjectNotification> results = query.getResultList();
-
- return new PageList<SubjectNotification>(results, (int) count, pageControl);
- }
-
- @SuppressWarnings("unchecked")
- public PageList<SubjectNotification> getSubjectNotificationsBySubjects(Integer[] subjectIds, PageControl pageControl) {
- pageControl.initDefaultOrderingField("rn.role.name");
-
- if ((subjectIds == null) || (subjectIds.length == 0)) {
- return new PageList<SubjectNotification>(Collections.EMPTY_LIST, 0, pageControl);
- }
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager,
- SubjectNotification.QUERY_FIND_BY_SUBJECT_IDS);
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager,
- SubjectNotification.QUERY_FIND_BY_SUBJECT_IDS, pageControl);
-
- queryCount.setParameter("ids", subjectIds);
- query.setParameter("ids", subjectIds);
-
- long count = (Long) queryCount.getSingleResult();
- List<SubjectNotification> results = query.getResultList();
-
- return new PageList<SubjectNotification>(results, (int) count, pageControl);
- }
public int removeNotifications(Subject subject, Integer alertDefinitionId, Integer[] notificationIds) {
AlertDefinition alertDefinition = getDetachedAlertDefinition(alertDefinitionId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
index 754bb63..2408723 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
@@ -25,13 +25,9 @@ import javax.ejb.Local;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.alert.notification.AlertNotification;
import org.rhq.core.domain.alert.notification.NotificationTemplate;
-import org.rhq.core.domain.alert.notification.RoleNotification;
-import org.rhq.core.domain.alert.notification.SubjectNotification;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderInfo;
import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
@@ -43,23 +39,6 @@ import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
@Local
public interface AlertNotificationManagerLocal {
- int addRoleNotifications(Subject subject, Integer alertDefinitionId, Integer[] roleIds);
-
- int addSubjectNotifications(Subject subject, Integer alertDefinitionId, Integer[] subjectId);
-
-
- PageList<RoleNotification> getRoleNotifications(Integer alertDefinitionId, PageControl pageControl);
-
- PageList<SubjectNotification> getSubjectNotifications(Integer alertDefinitionId, PageControl pageControl);
-
- PageList<RoleNotification> getRoleNotifications(Integer[] alertNotificationIds, PageControl pageControl);
-
- PageList<SubjectNotification> getSubjectNotifications(Integer[] alertNotificationIds, PageControl pageControl);
-
- PageList<RoleNotification> getRoleNotificationsByRoles(Integer[] roleIds, PageControl pageControl);
-
- PageList<SubjectNotification> getSubjectNotificationsBySubjects(Integer[] subjectId, PageControl pageControl);
-
/**
* Remove the passed notifications from the passed alert definition (all identified by their id)
* @param subject Caller
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index fd25d9b..dbe792f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -478,11 +478,6 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
throw new PermissionException("You cannot remove yourself: " + doomedSubject.getName());
}
- Query deleteNotificationQuery = entityManager
- .createQuery("DELETE FROM SubjectNotification sn WHERE sn.subject.id = :subjectId");
- deleteNotificationQuery.setParameter("subjectId", doomedSubjectId);
- deleteNotificationQuery.executeUpdate(); // discard result, might not have been set for any notifications
-
Set<Role> roles = doomedSubject.getRoles();
doomedSubject.setRoles(new HashSet<Role>()); // clean out roles
@@ -585,42 +580,6 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
}
}
- @SuppressWarnings("unchecked")
- public PageList<Subject> findAvailableSubjectsForAlertDefinition(Subject whoami, Integer alertDefinitionId,
- Integer[] pendingSubjectIds, PageControl pc) {
- pc.initDefaultOrderingField("s.name");
-
- String queryName;
-
- if ((pendingSubjectIds == null) || (pendingSubjectIds.length == 0)) {
- queryName = Subject.QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION;
- } else {
- queryName = Subject.QUERY_FIND_AVAILABLE_SUBJECTS_FOR_ALERT_DEFINITION_WITH_EXCLUDES;
- }
-
- Query countQuery = PersistenceUtility.createCountQuery(entityManager, queryName, "distinct s");
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, queryName, pc);
-
- countQuery.setParameter("alertDefinitionId", alertDefinitionId);
- query.setParameter("alertDefinitionId", alertDefinitionId);
-
- if ((pendingSubjectIds != null) && (pendingSubjectIds.length > 0)) {
- List<Integer> pendingIdsList = Arrays.asList(pendingSubjectIds);
- countQuery.setParameter("excludes", pendingIdsList);
- query.setParameter("excludes", pendingIdsList);
- }
-
- long count = (Long) countQuery.getSingleResult();
- List<Subject> subjects = query.getResultList();
-
- // eagerly load in the roles - can't use left-join due to PersistenceUtility usage; perhaps use EAGER
- for (Subject subject : subjects) {
- subject.getRoles().size();
- }
-
- return new PageList<Subject>(subjects, (int) count, pc);
- }
-
@RequiredPermission(Permission.MANAGE_SECURITY)
@SuppressWarnings("unchecked")
public PageList<Subject> findAvailableSubjectsForRole(Subject whoami, Integer roleId, Integer[] pendingSubjectIds,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
index e4d2611..e3f8ded 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerLocal.java
@@ -176,23 +176,6 @@ public interface SubjectManagerLocal {
PageList<Subject> findAvailableSubjectsForRole(Subject whoami, Integer roleId, Integer[] pendingSubjectIds,
PageControl pc);
- /**
- * This returns a list of subjects that are available to be assigned to a given alert definition but not yet
- * assigned to that alert definition. This excludes subjects already assigned to the alert definition. The returned
- * list will not include the subjects identified by <code>pendingSubjectIds</code> since it is assumed the pending
- * subjects will be assigned to the alert definition.
- *
- * @param whoami user attempting to make this call
- * @param alertDefinitionId the alert definition whose list of available subjects are to be returned
- * @param pendingSubjectIds the list of subjects that are planned to be given to the alert definition
- * @param pc
- *
- * @return the list of subjects that can be assigned to the given alert definition, not including the pending
- * subjects
- */
- PageList<Subject> findAvailableSubjectsForAlertDefinition(Subject whoami, Integer alertDefinitionId,
- Integer[] pendingSubjectIds, PageControl pc);
-
void logout(int sessionId);
Subject getSubjectById(int id);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index 3478499..8762845 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -133,11 +133,6 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
for (Integer roleId : doomedRoleIds) {
Role doomedRole = entityManager.find(Role.class, roleId);
- Query deleteNotificationQuery = entityManager
- .createQuery("DELETE FROM RoleNotification rn WHERE rn.role.id = :roleId");
- deleteNotificationQuery.setParameter("roleId", roleId);
- deleteNotificationQuery.executeUpdate(); // discard result, might not have been set for any notifications
-
Set<Subject> subjectsToUnhook = new HashSet<Subject>(doomedRole.getSubjects()); // avoid concurrent mod exception
for (Subject doomedSubjectRelationship : subjectsToUnhook) {
doomedRole.removeSubject(doomedSubjectRelationship);
@@ -388,42 +383,6 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
return findAvailableRolesForSubject(subject, subjectId, null, pc);
}
- @SuppressWarnings("unchecked")
- public PageList<Role> findAvailableRolesForAlertDefinition(Subject subject, Integer alertDefinitionId,
- Integer[] pendingRoleIds, PageControl pc) {
- pc.initDefaultOrderingField("r.name");
-
- String queryName;
-
- if ((pendingRoleIds == null) || (pendingRoleIds.length == 0)) {
- queryName = Role.QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION;
- } else {
- queryName = Role.QUERY_FIND_AVAILABLE_ROLES_FOR_ALERT_DEFINITION_WITH_EXCLUDES;
- }
-
- Query queryCount = PersistenceUtility.createCountQuery(entityManager, queryName, "distinct r");
- Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, queryName, pc);
-
- queryCount.setParameter("alertDefinitionId", alertDefinitionId);
- query.setParameter("alertDefinitionId", alertDefinitionId);
-
- if ((pendingRoleIds != null) && (pendingRoleIds.length > 0)) {
- List<Integer> pendingidslist = Arrays.asList(pendingRoleIds);
- queryCount.setParameter("excludes", pendingidslist);
- query.setParameter("excludes", pendingidslist);
- }
-
- long count = (Long) queryCount.getSingleResult();
- List<Role> roles = query.getResultList();
-
- // eagerly load in the members - can't use left-join due to PersistenceUtility usage; perhaps use EAGER
- for (Role role : roles) {
- role.getMemberCount();
- }
-
- return new PageList<Role>(roles, (int) count, pc);
- }
-
/**
* @see org.rhq.enterprise.server.authz.RoleManagerLocal#addResourceGroupsToRole(Subject, int, int[])
*/
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
index e3f1137..58f962a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerLocal.java
@@ -140,22 +140,6 @@ public interface RoleManagerLocal {
PageList<Role> findAvailableRolesForSubject(Subject subject, Integer subjectId, Integer[] pendingRoleIds,
PageControl pc);
- /**
- * This returns a list of roles that are available to be assigned to a given alert definition but not yet assigned
- * to that alert definition. This excludes roles already assigned to the alert definition. The returned list will
- * not include the roles identified by <code>pendingRoleIds</code> since it is assumed the pending roles will be
- * assigned to the alert definition.
- *
- * @param subject user attempting to make this call
- * @param alertDefinitionId the alert definition whose list of available roles are to be returned
- * @param pendingRoleIds the list of roles that are planned to be given to the alert definition
- * @param pc
- *
- * @return the list of roles that can be assigned to the given alert definition, not including the pending roles
- */
- PageList<Role> findAvailableRolesForAlertDefinition(Subject subject, Integer alertDefinitionId,
- Integer[] pendingRoleIds, PageControl pc);
-
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// The following are shared with the Remote Interface
@@ -177,7 +161,7 @@ public interface RoleManagerLocal {
PageList<Role> findSubjectAssignedRoles(Subject subject, int subjectId, PageControl pc);
- //This is a proxy of getAvailableRolesForSubject but without pendingRoleIds as required by remote spec
+ //This is a proxy of getAvailableRolesForSubject but without pendingRoleIds as required by remote spec
PageList<Role> findSubjectUnassignedRoles(Subject subject, int subjectId, PageControl pc);
/**
commit 5d524aef822b870cae459e9d60cae098895c11bc
Merge: 0bdc87c... 6a0eb34...
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Tue Feb 2 22:44:21 2010 -0500
Merge branch 'linux-config' of ssh://git.fedorahosted.org/git/rhq/rhq into linux-config
commit 0bdc87c603f5fe05daa63db886788932005fdef6
Author: Ian P. Springer <ips(a)jetengine.springer.net>
Date: Tue Feb 2 21:46:46 2010 -0500
improve descriptions for freeMemory, maxMemory, and totalMemory metrics on JBoss AS Server resourceTypes
diff --git a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
index e9049da..3897a27 100644
--- a/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-5/src/main/resources/META-INF/rhq-plugin.xml
@@ -1119,15 +1119,15 @@
defaultInterval="300000" defaultOn="true" category="throughput"/>
<metric displayName="JVM Free Memory" property="MCBean|ServerInfo|*|freeMemory" displayType="summary"
- description="The amount of free memory for the JVM this app server instance is running on"
+ description="An approximation of the total amount of memory currently available in the app server JVM for future allocated objects, measured in bytes"
defaultInterval="300000" defaultOn="true" category="utilization" units="bytes"/>
<metric displayName="JVM Max Memory" property="MCBean|ServerInfo|*|maxMemory"
- description="The amount of max memory for the JVM this app server instance is running on"
+ description="The maximum amount of memory that the app server JVM will attempt to use, measured in bytes; if there is no inherent limit then the value Long.MAX_VALUE will be returned"
defaultInterval="1800000" defaultOn="true" category="utilization" units="bytes"/>
<metric displayName="JVM Total Memory" property="MCBean|ServerInfo|*|totalMemory" displayType="summary"
- description="The amount of total memory for the JVM this app server instance is running on"
+ description="The total amount of memory currently available in the app server JVM for current and future objects, measured in bytes"
defaultInterval="300000" defaultOn="true" category="utilization" units="bytes"/>
<metric displayName="Total Transactions" property="MCBean|JTA|*|transactionCount" measurementType="trendsup"
diff --git a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
index fa7bdc1..aec1c9a 100644
--- a/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as/src/main/resources/META-INF/rhq-plugin.xml
@@ -192,15 +192,15 @@
defaultInterval="300000" defaultOn="true" category="throughput"/>
<metric property="jboss.system:type=ServerInfo:FreeMemory" displayName="JVM Free Memory" displayType="summary"
- description="The amount of free memory for the JVM this app server instance is running on"
+ description="An approximation of the total amount of memory currently available in the app server JVM for future allocated objects, measured in bytes"
defaultInterval="300000" defaultOn="true" category="utilization" units="bytes"/>
<metric property="jboss.system:type=ServerInfo:MaxMemory" displayName="JVM Max Memory"
- description="The amount of max memory for the JVM this app server instance is running on"
+ description="The maximum amount of memory that the app server JVM will attempt to use, measured in bytes; if there is no inherent limit then the value Long.MAX_VALUE will be returned"
defaultInterval="1800000" defaultOn="true" category="utilization" units="bytes"/>
<metric property="jboss.system:type=ServerInfo:TotalMemory" displayName="JVM Total Memory" displayType="summary"
- description="The amount of total memory for the JVM this app server instance is running on"
+ description="The total amount of memory currently available in the app server JVM for current and future objects, measured in bytes"
defaultInterval="300000" defaultOn="true" category="utilization" units="bytes"/>
<metric property="jboss:service=TransactionManager:TransactionCount" displayName="Total Transactions" measurementType="trendsup"
commit e237e52515244d1d55895b494f4e046754222d7c
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 2 20:58:50 2010 -0500
Fixed unit tests and fixed bug on loading resrouces that support only structured.
diff --git a/.classpath b/.classpath
index 2cf4832..5746d68 100644
--- a/.classpath
+++ b/.classpath
@@ -117,7 +117,6 @@
<classpathentry kind="src" path="modules/plugins/byteman/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/lsof/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/jdbctrace/src/main/java"/>
- <classpathentry kind="src" path="modules/plugins/antlr-config/src/main/antlr3"/>
<classpathentry kind="src" path="modules/plugins/augeas/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/augeas/src/test/java"/>
<classpathentry kind="src" path="modules/helpers/rtfilter/src/main/java"/>
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
index bccbc56..a3eddb0 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImpl.java
@@ -28,7 +28,10 @@ import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceFacets;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.util.ComponentService;
+import org.rhq.core.pc.util.ComponentUtil;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
@@ -55,6 +58,7 @@ public class ConfigManagementFactoryImpl implements ConfigManagementFactory {
configManagement.setConfigurationUtilityService(configUtilityService);
}
+ @SuppressWarnings("unchecked")
private ConfigManagement createStrategy(int resourceId) throws PluginContainerException {
ResourceType resourceType = componentService.getResourceType(resourceId);
ConfigurationFormat format = resourceType.getResourceConfigurationDefinition().getConfigurationFormat();
@@ -70,12 +74,8 @@ public class ConfigManagementFactoryImpl implements ConfigManagementFactory {
return new StructuredAndRawConfigManagement();
case STRUCTURED:
default:
- boolean daemonOnly = true;
- boolean onlyIfStarted = true;
- ResourceComponent resourceComponent = componentService.getComponent(resourceId,
- ResourceComponent.class, FacetLockType.READ, ConfigManagement.FACET_METHOD_TIMEOUT,
- daemonOnly, onlyIfStarted);
- if (resourceComponent instanceof ResourceConfigurationFacet){
+
+ if (componentService.fetchResourceComponent(resourceId) instanceof ResourceConfigurationFacet){
return new StructuredConfigManagement();
} else{
return new LegacyConfigManagement();
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentService.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentService.java
index f831ae4..e7fd6cd 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentService.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentService.java
@@ -26,6 +26,8 @@ package org.rhq.core.pc.util;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
public interface ComponentService {
@@ -36,4 +38,6 @@ public interface ComponentService {
String getAmpsVersion(int resourceId) throws PluginContainerException;
+ ResourceComponent fetchResourceComponent(int resourceId);
+
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentServiceImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentServiceImpl.java
index fa8923c..e1453a6 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentServiceImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentServiceImpl.java
@@ -28,6 +28,8 @@ import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.pc.PluginContainer;
import org.rhq.core.pc.plugin.PluginManager;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
public class ComponentServiceImpl implements ComponentService {
@@ -48,4 +50,8 @@ public class ComponentServiceImpl implements ComponentService {
return pluginMgr.getAmpsVersion(resourceType.getPlugin());
}
+
+ public ResourceComponent fetchResourceComponent(int resourceId) {
+ return ComponentUtil.fetchResourceComponent(resourceId);
+ }
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentUtil.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentUtil.java
index c137b13..9eb6e71 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentUtil.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/ComponentUtil.java
@@ -27,6 +27,7 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.PluginContainer;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
/**
* Some static utilities for use with component objects.
@@ -103,4 +104,9 @@ public class ComponentUtil {
}
return resourceContainer.createResourceComponentProxy(facetInterface, lockType, timeout, daemonThread, onlyIfStarted);
}
+
+ @SuppressWarnings("unchecked")
+ public static ResourceComponent fetchResourceComponent(int resourceId) {
+ return PluginContainer.getInstance().getInventoryManager().getResourceContainer(resourceId).getResourceComponent();
+ }
}
\ No newline at end of file
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
index 32888ad..c8443e9 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/configuration/ConfigManagementFactoryImplTest.java
@@ -25,15 +25,27 @@ package org.rhq.core.pc.configuration;
import static org.testng.Assert.*;
+import java.util.Set;
+
import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
+
+import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.RawConfiguration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
import org.jmock.Expectations;
+
+
public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
static final String LEGACY_AMPS_VERSION = "2.0";
@@ -55,14 +67,19 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final boolean daemonOnly = true;
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
+
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacet()));
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -74,14 +91,20 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final boolean daemonOnly = true;
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
+
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacetForLegacy()));
+
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -92,16 +115,21 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
public void factoryShouldInitializeStructuredConfigMgmtWithComponentService() throws Exception {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- boolean daemonOnly = true;
-
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ boolean daemonOnly = true;
+
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
+
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacet()));
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -114,14 +142,20 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
+
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacet()));
+
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -134,14 +168,16 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsRaw()));
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -154,14 +190,16 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsRaw()));
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -174,14 +212,19 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
+
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacet()));
+ }
+ });
ConfigManagement loadConfig = factory.getStrategy(resourceId);
@@ -195,14 +238,19 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
final ResourceComponent resourceComponent = context.mock(ResourceComponent.class);
- context.checking(new Expectations() {{
- allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
- ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
- will(returnValue(resourceComponent));
+ context.checking(new Expectations() {
+ {
+ allowing(componentService).getComponent(resourceId, ResourceComponent.class, FacetLockType.READ,
+ ConfigManagement.FACET_METHOD_TIMEOUT, daemonOnly, onlyIfStarted);
+ will(returnValue(resourceComponent));
- allowing(componentService).getResourceType(resourceId);
- will(returnValue(createResourceTypeThatSupportsStructured()));
- }});
+ allowing(componentService).getResourceType(resourceId);
+ will(returnValue(createResourceTypeThatSupportsStructured()));
+
+ allowing(componentService).fetchResourceComponent(resourceId);
+ will(returnValue(new MockResourceConfigurationFacet()));
+ }
+ });
ConfigManagement configManagement = factory.getStrategy(resourceId);
@@ -210,18 +258,19 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
}
void assertComponentServiceInitialized(ConfigManagement configMgmt) {
- assertNotNull(configMgmt.getComponentService(), "The factory must initialize the componentService " +
- "property of the loadConfig object.");
+ assertNotNull(configMgmt.getComponentService(), "The factory must initialize the componentService "
+ + "property of the loadConfig object.");
}
void assertConfigurationUtilityServiceInitialized(ConfigManagement configMgmt) {
- assertNotNull(configMgmt.getConfigurationUtilityService(), "The factory must initialize the " +
- "configurationUtilityService property of the loadConfig object.");
+ assertNotNull(configMgmt.getConfigurationUtilityService(), "The factory must initialize the "
+ + "configurationUtilityService property of the loadConfig object.");
}
ResourceType createResourceType() {
ResourceType resourceType = new ResourceType();
- resourceType.setResourceConfigurationDefinition(new ConfigurationDefinition("test_config", "Test Configuration"));
+ resourceType
+ .setResourceConfigurationDefinition(new ConfigurationDefinition("test_config", "Test Configuration"));
return resourceType;
}
@@ -242,9 +291,88 @@ public class ConfigManagementFactoryImplTest extends ConfigManagementTest {
ResourceType createResourceTypeThatSupportsStructuredAndRaw() {
ResourceType resourceType = createResourceType();
- resourceType.getResourceConfigurationDefinition().setConfigurationFormat(ConfigurationFormat.STRUCTURED_AND_RAW);
+ resourceType.getResourceConfigurationDefinition()
+ .setConfigurationFormat(ConfigurationFormat.STRUCTURED_AND_RAW);
return resourceType;
}
}
+
+class MockResourceConfigurationFacetForLegacy implements ResourceComponent{
+
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException, Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public AvailabilityType getAvailability() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
+
+
+class MockResourceConfigurationFacet implements ResourceComponent, ResourceConfigurationFacet {
+
+ public void validateStructuredConfiguration(Configuration configuration) {
+ // TODO Auto-generated method stub
+ }
+
+ public void validateRawConfiguration(RawConfiguration rawConfiguration) throws RuntimeException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void persistStructuredConfiguration(Configuration configuration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void persistRawConfiguration(RawConfiguration rawConfiguration) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mergeStructuredConfiguration(RawConfiguration from, Configuration to) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public RawConfiguration mergeRawConfiguration(Configuration from, RawConfiguration to) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Configuration loadStructuredConfiguration() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<RawConfiguration> loadRawConfigurations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException, Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public AvailabilityType getAvailability() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+};
+
+
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 619fe36..5c28e01 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,6 +27,7 @@ import org.hamcrest.Matcher;
import org.jmock.Expectations;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
@@ -324,7 +325,7 @@ public class ConfigurationManagerTest extends ConfigManagementTest {
configurationMgr.validate(configuration, resourceId, false);
assertTrue(false);
} catch (PluginContainerException exception) {
- assertEquals(exception.getMessage(), "file /tmp/foo.txt failed validation with message.");
+ //SUCCESS
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml
new file mode 100644
index 0000000..922c183
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+
+<body>
+
+<h:form>
+ <rich:panel bodyClass="rich-laguna-panel-no-header">
+ <a4j:commandButton value="Set Name to Alex" reRender="rep" >
+ <a4j:actionparam name="username" value="Alex" assignTo="#{userBean.name}"/>
+ </a4j:commandButton>
+ <rich:spacer width="20" />
+ <a4j:commandButton value="Set Name to John" reRender="rep" >
+ <a4j:actionparam name="username" value="John" assignTo="#{userBean.name}"/>
+ </a4j:commandButton>
+ </rich:panel>
+ <rich:spacer height="1" />
+ <rich:panel bodyClass="rich-laguna-panel-no-header">
+ <h:outputText id="rep" value="Selected Name:#{userBean.name}"/>
+ </rich:panel>
+</h:form>
+</body>
+</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml~ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml~
new file mode 100644
index 0000000..238ccb4
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/test/config/raw/isolate.xhtml~
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:onc="http://jboss.org/on/component">
+
+THIS TEXT WILL BE REMOVED.
+
+<ui:composition template="/rhq/layout/main.xhtml">
+
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:param name="pageTitle" value="View Test Configuration"/>
+
+ <ui:define name="body">
+
+ <script language="JavaScript" type="text/javascript" src="/js/multi-file-edit.js"></script>
+
+ <h:messages showSummary="true"
+ showDetail="true"
+ errorClass="ErrorBlock"
+ warnClass="ErrorBlock"
+ infoClass="ConfirmationBlock"
+ globalOnly="true"
+ layout="table"
+ width="100%"/>
+ <a href="edit-raw-config.xhtml">Edit</a>
+
+ <form id="testForm">
+ <script type="text/javascript">
+ var multiFileEdit = new MultiFileEdit();
+ multiFileEdit.disabled=1;
+ multiFileEdit.drawTable();
+ </script>
+ <input type="submit" />
+ <input type="reset" onclick="multiFileEdit.resetArchive();" />
+ </form>
+
+ </ui:define>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/RepoSyncJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/RepoSyncJob.java
index 5e4e995..4d0ad10 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/RepoSyncJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/RepoSyncJob.java
@@ -217,9 +217,7 @@ public class RepoSyncJob implements StatefulJob, InterruptableJob {
repoManager.internalSynchronizeRepos(overlord, new Integer[] { repoToSync.getId() });
}
- @Override
public void interrupt() throws UnableToInterruptJobException {
-
if (executionThread == null) {
log.error("execution thread is null, cant interrupt", new IllegalStateException());
diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml
index f3ff3f6..37d2f9f 100644
--- a/modules/plugins/virt/pom.xml
+++ b/modules/plugins/virt/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/plugins/virt/</scm.module.path>
- <libvirt-java.version>0.3.2</libvirt-java.version>
+ <libvirt-java.version>0.4.1</libvirt-java.version>
</properties>
<dependencies>
diff --git a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java
index 1615c72..749c4c1 100644
--- a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java
+++ b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java
@@ -74,7 +74,6 @@ public class VirtualizationHostDiscoveryComponent implements ResourceDiscoveryCo
return res;
}
- @Override
public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
return getResource(context.getResourceType(), pluginConfiguration);
diff --git a/test-output/emailable-report.html b/test-output/emailable-report.html
new file mode 100644
index 0000000..2fec89b
--- /dev/null
+++ b/test-output/emailable-report.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>TestNG: Unit Test</title>
+<style type="text/css">
+table caption,table.info_table,table.param,table.passed,table.failed {margin-bottom:10px;border:1px solid #000099;border-collapse:collapse;empty-cells:show;}
+table.info_table td,table.info_table th,table.param td,table.param th,table.passed td,table.passed th,table.failed td,table.failed th {
+border:1px solid #000099;padding:.25em .5em .25em .5em
+}
+table.param th {vertical-align:bottom}
+td.numi,th.numi,td.numi_attn {
+text-align:right
+}
+tr.total td {font-weight:bold}
+table caption {
+text-align:center;font-weight:bold;
+}
+table.passed tr.stripe td,table tr.passedodd td {background-color: #00AA00;}
+table.passed td,table tr.passedeven td {background-color: #33FF33;}
+table.passed tr.stripe td,table tr.skippedodd td {background-color: #cccccc;}
+table.passed td,table tr.skippedodd td {background-color: #dddddd;}
+table.failed tr.stripe td,table tr.failedodd td,table.param td.numi_attn {background-color: #FF3333;}
+table.failed td,table tr.failedeven td,table.param tr.stripe td.numi_attn {background-color: #DD0000;}
+tr.stripe td,tr.stripe th {background-color: #E6EBF9;}
+p.totop {font-size:85%;text-align:center;border-bottom:2px black solid}
+div.shootout {padding:2em;border:3px #4854A8 solid}
+</style>
+</head>
+<body>
+<table cellspacing=0 cellpadding=0 class="param">
+<tr><th>Test</th><th class="numi">Methods<br/>Passed</th><th class="numi">Scenarios<br/>Passed</th><th class="numi"># skipped</th><th class="numi"># failed</th><th class="numi">Total<br/>Time</th><th class="numi">Included<br/>Groups</th><th class="numi">Excluded<br/>Groups</th></tr>
+<tr><td style="text-align:left;padding-right:2em">classes</td><td class="numi">8</td><td class="numi">8</td><td class="numi">0</td><td class="numi">0</td><td class="numi">0.2 seconds</td><td class="numi"></td><td class="numi"></td></tr>
+</table>
+<a id="summary"></a>
+<table cellspacing=0 cellpadding=0 class="passed">
+<tr><th>Class</th><th>Method</th><th># of<br/>Scenarios</th><th>Time<br/>(Msecs)</th></tr>
+<tr><th colspan="4">classes — passed</th></tr>
+<tr class="passedodd"><td rowspan="8">org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest<br>"classes"<td><a href="#m1"><b>factoryShouldInitializeLegacyConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">51</td></tr><tr class="passedodd"><td><a href="#m2"><b>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">4</td></tr><tr class="passedodd"><td><a href="#m3"><b>factoryShouldInitializeLoadStructuredAndRawWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">2</td></tr><tr class="passedodd"><td><a href="#m4"><b>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">5</td></tr><tr class="passedodd"><td><a href="#m5"><b>factoryShouldInitializeRawConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">5</td></tr><tr class="passedodd"><td><a href="#m6"><b>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">16</td></tr><tr class="passedodd"><td><a href="#m7"><b>factoryShouldInitializeStructuredConfigMgmtWithComponentService</b> </a></td><td class="numi">1</td><td class="numi">14</td></tr><tr class="passedodd"><td><a href="#m8"><b>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</b> </a></td><td class="numi">1</td><td class="numi">16</td></tr>
+</table>
+<h1>classes</h1>
+<a id="m1"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLegacyConfigMgmtWithComponentService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m2"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m3"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLoadStructuredAndRawWithComponentService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m4"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m5"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeRawConfigMgmtWithComponentService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m6"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m7"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeStructuredConfigMgmtWithComponentService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+<a id="m8"></a><h2>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest:factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</h2>
+<p class="totop"><a href="#summary">back to summary</a></p>
+</body></html>
diff --git a/test-output/index.html b/test-output/index.html
new file mode 100644
index 0000000..87b37e4
--- /dev/null
+++ b/test-output/index.html
@@ -0,0 +1,9 @@
+<html>
+<head><title>Test results</title><link href="./testng.css" rel="stylesheet" type="text/css" />
+<link href="./my-testng.css" rel="stylesheet" type="text/css" />
+</head><body>
+<h2><p align='center'>Test results</p></h2>
+<table border='1' width='100%' class='main-page'><tr><th>Suite</th><th>Passed</th><th>Failed</th><th>Skipped</th><th>testng.xml</th></tr>
+<tr align='center' class='invocation-passed'><td><em>Total</em></td><td><em>8</em></td><td><em>0</em></td><td><em>0</em></td><td> </td></tr>
+<tr align='center' class='invocation-passed'><td><a href='rhq/index.html'>rhq</a></td>
+<td>8</td><td>0</td><td>0</td><td><a href='rhq/testng.xml.html'>Link</a></td></tr></table></body></html>
diff --git a/test-output/rhq/classes.html b/test-output/rhq/classes.html
new file mode 100644
index 0000000..f027d8a
--- /dev/null
+++ b/test-output/rhq/classes.html
@@ -0,0 +1,68 @@
+<table border='1'>
+<tr>
+<th>Class name</th>
+<th>Method name</th>
+<th>Groups</th>
+</tr><tr>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td> </td><td> </td></tr>
+<tr>
+<td align='center' colspan='3'>@Test</td>
+</tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeRawConfigMgmtWithComponentService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
+<td> </td></tr>
+<tr>
+<td align='center' colspan='3'>@BeforeClass</td>
+</tr>
+<tr>
+<td align='center' colspan='3'>@BeforeMethod</td>
+</tr>
+<tr>
+<td> </td>
+<td>initContext</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>initMocks</td>
+<td> </td></tr>
+<tr>
+<td> </td>
+<td>setup</td>
+<td> </td></tr>
+<tr>
+<td align='center' colspan='3'>@AfterMethod</td>
+</tr>
+<tr>
+<td align='center' colspan='3'>@AfterClass</td>
+</tr>
+</table>
diff --git a/test-output/rhq/classes.properties b/test-output/rhq/classes.properties
new file mode 100644
index 0000000..1305823
--- /dev/null
+++ b/test-output/rhq/classes.properties
@@ -0,0 +1 @@
+[SuiteResult classes]
\ No newline at end of file
diff --git a/test-output/rhq/classes.xml b/test-output/rhq/classes.xml
new file mode 100644
index 0000000..758938a
--- /dev/null
+++ b/test-output/rhq/classes.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="classes" failures="0" tests="8" time="0.212" errors="0">
+ <properties/>
+ <testcase name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" time="0.051" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" time="0.004" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" time="0.002" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" time="0.005" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeRawConfigMgmtWithComponentService" time="0.005" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" time="0.016" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" time="0.014" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" time="0.016" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+</testsuite>
diff --git a/test-output/rhq/groups.html b/test-output/rhq/groups.html
new file mode 100644
index 0000000..199cb3f
--- /dev/null
+++ b/test-output/rhq/groups.html
@@ -0,0 +1 @@
+<h2>Groups used for this test run</h2>
\ No newline at end of file
diff --git a/test-output/rhq/index.html b/test-output/rhq/index.html
new file mode 100644
index 0000000..c168c9b
--- /dev/null
+++ b/test-output/rhq/index.html
@@ -0,0 +1,6 @@
+<html><head><title>Results for rhq</title></head>
+<frameset cols="26%,74%">
+<frame src="toc.html" name="navFrame">
+<frame src="main.html" name="mainFrame">
+</frameset>
+</html>
diff --git a/test-output/rhq/main.html b/test-output/rhq/main.html
new file mode 100644
index 0000000..2240bae
--- /dev/null
+++ b/test-output/rhq/main.html
@@ -0,0 +1,2 @@
+<html><head><title>Results for rhq</title></head>
+<body>Select a result on the left-hand pane.</body></html>
diff --git a/test-output/rhq/methods-alphabetical.html b/test-output/rhq/methods-alphabetical.html
new file mode 100644
index 0000000..65038a1
--- /dev/null
+++ b/test-output/rhq/methods-alphabetical.html
@@ -0,0 +1,68 @@
+<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>rhq</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
+<table border="1">
+<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()">factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>56</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>63</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()">factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>73</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()">factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>83</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()">factoryShouldInitializeRawConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>116</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>146</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()">factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>175</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>160</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+</table>
diff --git a/test-output/rhq/methods-not-run.html b/test-output/rhq/methods-not-run.html
new file mode 100644
index 0000000..54b14cb
--- /dev/null
+++ b/test-output/rhq/methods-not-run.html
@@ -0,0 +1,2 @@
+<h2>Methods that were not run</h2><table>
+</table>
\ No newline at end of file
diff --git a/test-output/rhq/methods.html b/test-output/rhq/methods.html
new file mode 100644
index 0000000..9fe711c
--- /dev/null
+++ b/test-output/rhq/methods.html
@@ -0,0 +1,68 @@
+<h2>Methods run, sorted chronologically</h2><h3>>> means before, << means after</h3><p/><br/><em>rhq</em><p/><small><i>(Hover the method name to see the test class name)</i></small><p/>
+<table border="1">
+<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-160</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()">factoryShouldInitializeLegacyConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-104</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-97</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()">factoryShouldInitializeLoadStructuredAndRawWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-87</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()">factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-77</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()">factoryShouldInitializeRawConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-44</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>-14</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()">factoryShouldInitializeStructuredConfigMgmtWithComponentService</td>
+ <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="b0ce8f"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.test.JMockTest.initContext()">>>initContext</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="e97fbd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementTest.initMocks()">>>initMocks</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>0</td> <td> </td><td> </td><td> </td><td> </td><td title=">>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.setup()">>>setup</td>
+<td> </td> <td>main@564660841</td> <td></td> </tr>
+<tr bgcolor="8a75cd"> <td>10/02/02 20:31:22</td> <td>15</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td title="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()">factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</td>
+ <td>main@564660841</td> <td></td> </tr>
+</table>
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html
new file mode 100644
index 0000000..195d609
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.html
@@ -0,0 +1,596 @@
+<html>
+<head>
+<title>TestNG: org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</title>
+<link href="../testng.css" rel="stylesheet" type="text/css" />
+<link href="../my-testng.css" rel="stylesheet" type="text/css" />
+
+<style type="text/css">
+.log { display: none;}
+.stack-trace { display: none;}
+</style>
+<script type="text/javascript">
+<!--
+function flip(e) {
+ current = e.style.display;
+ if (current == 'block') {
+ e.style.display = 'none';
+ return 0;
+ }
+ else {
+ e.style.display = 'block';
+ return 1;
+ }
+}
+
+function toggleBox(szDivId, elem, msg1, msg2)
+{
+ var res = -1; if (document.getElementById) {
+ res = flip(document.getElementById(szDivId));
+ }
+ else if (document.all) {
+ // this is the way old msie versions work
+ res = flip(document.all[szDivId]);
+ }
+ if(elem) {
+ if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
+ }
+
+}
+
+function toggleAllBoxes() {
+ if (document.getElementsByTagName) {
+ d = document.getElementsByTagName('div');
+ for (i = 0; i < d.length; i++) {
+ if (d[i].className == 'log') {
+ flip(d[i]);
+ }
+ }
+ }
+}
+
+// -->
+</script>
+
+</head>
+<body>
+<h2 align='center'>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</h2><table border='1' align="center">
+<tr>
+<td>Tests passed/Failed/Skipped:</td><td>1/7/0</td>
+</tr><tr>
+<td>Started on:</td><td>Tue Feb 02 16:31:43 EST 2010</td>
+</tr>
+<tr><td>Total time:</td><td>189 seconds (189379 ms)</td>
+</tr><tr>
+<td>Included groups:</td><td></td>
+</tr><tr>
+<td>Excluded groups:</td><td></td>
+</tr>
+</table><p/>
+<small><i>(Hover the method name to see the test class name)</i></small><p/>
+<table width='100%' border='1' class='invocation-failed'>
+<tr><td colspan='4' align='center'><b>FAILED TESTS</b></td></tr>
+<tr><td><b>Test method</b></td>
+<td><b>Instance</b></td>
+<td width="10%"><b>Time (seconds)</b></td>
+<td width="30%"><b>Exception</b></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace2020350594", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace2020350594'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService()'><b>factoryShouldInitializeLoadStructuredAndRawWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>125</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace917483082", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace917483082'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()'><b>factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>55</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1619519236", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace1619519236'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService()'><b>factoryShouldInitializeRawConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>1</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1685580695", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace1685580695'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace999186587", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace999186587'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService()'><b>factoryShouldInitializeStructuredConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace2120070574", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace2120070574'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()'><b>factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>0</td>
+<td><div><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1727921240", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace1727921240'><pre>unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+</table><p>
+<table width='100%' border='1' class='invocation-passed'>
+<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
+<tr><td><b>Test method</b></td>
+<td><b>Instance</b></td>
+<td width="10%"><b>Time (seconds)</b></td>
+<td width="30%"><b>Exception</b></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithComponentService()'><b>factoryShouldInitializeLegacyConfigMgmtWithComponentService</b><br>Test class:org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest</td>
+<td>org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest@7ed75415</td><td>4</td>
+<td></td>
+</tr>
+</table><p>
+</body>
+</html>
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties
new file mode 100644
index 0000000..24d8a18
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.properties
@@ -0,0 +1 @@
+[SuiteResult org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest]
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml
new file mode 100644
index 0000000..9731c48
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest" failures="7" tests="8" time="189.379" errors="0">
+ <properties/>
+ <testcase name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" time="4.489" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/>
+ <testcase name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" time="0.008" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:171)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" time="125.987" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithComponentService(ConfigManagementFactoryImplTest.java:281)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" time="55.251" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:304)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeRawConfigMgmtWithComponentService" time="1.564" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:237)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" time="0.692" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:259)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" time="0.495" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithComponentService(ConfigManagementFactoryImplTest.java:193)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+ <testcase name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" time="0.544" classname="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <failure type="org.jmock.api.ExpectationError" message="unexpected invocation">
+ <![CDATA[unexpected invocation: componentService.fetchResourceComponent(<-1>)
+expectations:
+ allowed, never invoked: componentService.getComponent(<-1>, <interface org.rhq.core.pluginapi.inventory.ResourceComponent>, <READ>, <60000L>, <true>, <true>); returns <resourceComponent>
+ allowed, already invoked 1 time: componentService.getResourceType(<-1>); returns <ResourceType[id=0, category=null, name=null, plugin=null]>
+what happened before this:
+ componentService.getResourceType(<-1>)
+
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:56)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy5.fetchResourceComponent(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.createStrategy(ConfigManagementFactoryImpl.java:78)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImpl.getStrategy(ConfigManagementFactoryImpl.java:50)
+ at org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest.factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService(ConfigManagementFactoryImplTest.java:215)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames]]>
+ </failure>
+ </testcase>
+</testsuite>
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html
new file mode 100644
index 0000000..a03885a
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.html
@@ -0,0 +1,229 @@
+<html>
+<head>
+<title>TestNG: org.rhq.core.pc.configuration.ConfigurationManagerTest</title>
+<link href="../testng.css" rel="stylesheet" type="text/css" />
+<link href="../my-testng.css" rel="stylesheet" type="text/css" />
+
+<style type="text/css">
+.log { display: none;}
+.stack-trace { display: none;}
+</style>
+<script type="text/javascript">
+<!--
+function flip(e) {
+ current = e.style.display;
+ if (current == 'block') {
+ e.style.display = 'none';
+ return 0;
+ }
+ else {
+ e.style.display = 'block';
+ return 1;
+ }
+}
+
+function toggleBox(szDivId, elem, msg1, msg2)
+{
+ var res = -1; if (document.getElementById) {
+ res = flip(document.getElementById(szDivId));
+ }
+ else if (document.all) {
+ // this is the way old msie versions work
+ res = flip(document.all[szDivId]);
+ }
+ if(elem) {
+ if(res == 0) elem.innerHTML = msg1; else elem.innerHTML = msg2;
+ }
+
+}
+
+function toggleAllBoxes() {
+ if (document.getElementsByTagName) {
+ d = document.getElementsByTagName('div');
+ for (i = 0; i < d.length; i++) {
+ if (d[i].className == 'log') {
+ flip(d[i]);
+ }
+ }
+ }
+}
+
+// -->
+</script>
+
+</head>
+<body>
+<h2 align='center'>org.rhq.core.pc.configuration.ConfigurationManagerTest</h2><table border='1' align="center">
+<tr>
+<td>Tests passed/Failed/Skipped:</td><td>10/0/0</td>
+</tr><tr>
+<td>Started on:</td><td>Tue Feb 02 15:16:58 EST 2010</td>
+</tr>
+<tr><td>Total time:</td><td>0 seconds (539 ms)</td>
+</tr><tr>
+<td>Included groups:</td><td></td>
+</tr><tr>
+<td>Excluded groups:</td><td></td>
+</tr>
+</table><p/>
+<small><i>(Hover the method name to see the test class name)</i></small><p/>
+<table width='100%' border='1' class='invocation-passed'>
+<tr><td colspan='4' align='center'><b>PASSED TESTS</b></td></tr>
+<tr><td><b>Test method</b></td>
+<td><b>Instance</b></td>
+<td width="10%"><b>Time (seconds)</b></td>
+<td width="30%"><b>Exception</b></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.catchExceptionThrownByFailedValidationOfRawConfigs()'><b>catchExceptionThrownByFailedValidationOfRawConfigs</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull()'><b>exceptionShouldBeThrownIfConfigIsNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td><div><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: returned a null Configuration.
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:264)
+ at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull(ConfigurationManagerTest.java:112)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1170987530", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace1170987530'><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: returned a null Configuration.
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:264)
+ at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownIfConfigIsNull(ConfigurationManagerTest.java:112)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException()'><b>exceptionShouldBeThrownWhenStrategyThrowsAnException</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td><div><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: An exception was thrown.
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:260)
+ at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException(ConfigurationManagerTest.java:132)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+Caused by: java.lang.RuntimeException
+ at org.jmock.lib.action.ThrowAction.invoke(ThrowAction.java:27)
+ at org.jmock.internal.InvocationExpectation.invoke(InvocationExpectation.java:114)
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:52)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy11.executeLoad(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:258)
+ ... 30 more
+... Removed 28 stack frames</pre></div><a href='#' onClick='toggleBox("stack-trace1651716188", this, "Click to show all stack frames", "Click to hide stack frames")'>Click to show all stack frames</a>
+<div class='stack-trace' id='stack-trace1651716188'><pre>org.rhq.core.clientapi.agent.PluginContainerException: Plugin Error: Resource Component for [null] Resource with id [-1]: An exception was thrown.
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:260)
+ at org.rhq.core.pc.configuration.ConfigurationManagerTest.exceptionShouldBeThrownWhenStrategyThrowsAnException(ConfigurationManagerTest.java:132)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:644)
+ at org.testng.internal.MethodHelper$1.runTestMethod(MethodHelper.java:762)
+ at org.rhq.test.JMockTest.run(JMockTest.java:42)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at org.testng.internal.MethodHelper.invokeHookable(MethodHelper.java:770)
+ at org.testng.internal.Invoker.invokeMethod(Invoker.java:539)
+ at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:700)
+ at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1002)
+ at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
+ at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
+ at org.testng.TestRunner.runWorkers(TestRunner.java:909)
+ at org.testng.TestRunner.privateRun(TestRunner.java:618)
+ at org.testng.TestRunner.run(TestRunner.java:499)
+ at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
+ at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
+ at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
+ at org.testng.SuiteRunner.run(SuiteRunner.java:204)
+ at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:915)
+ at org.testng.TestNG.runSuitesLocally(TestNG.java:879)
+ at org.testng.TestNG.run(TestNG.java:787)
+ at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
+ at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
+Caused by: java.lang.RuntimeException
+ at org.jmock.lib.action.ThrowAction.invoke(ThrowAction.java:27)
+ at org.jmock.internal.InvocationExpectation.invoke(InvocationExpectation.java:114)
+ at org.jmock.internal.InvocationDispatcher.dispatch(InvocationDispatcher.java:52)
+ at org.jmock.Mockery.dispatch(Mockery.java:218)
+ at org.jmock.Mockery.access$000(Mockery.java:43)
+ at org.jmock.Mockery$MockObject.invoke(Mockery.java:258)
+ at org.jmock.internal.InvocationDiverter.invoke(InvocationDiverter.java:27)
+ at org.jmock.internal.FakeObjectMethods.invoke(FakeObjectMethods.java:38)
+ at org.jmock.lib.JavaReflectionImposteriser$1.invoke(JavaReflectionImposteriser.java:33)
+ at $Proxy11.executeLoad(Unknown Source)
+ at org.rhq.core.pc.configuration.ConfigurationManager.loadResourceConfiguration(ConfigurationManager.java:258)
+ ... 30 more
+</pre></div></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingRawsIntoStructuredShouldIgnoreNull()'><b>mergingRawsIntoStructuredShouldIgnoreNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig()'><b>mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStructuredIntoRawShouldDoNothingIfRawsAreNull()'><b>mergingStructuredIntoRawShouldDoNothingIfRawsAreNull</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStructuredIntoRawShouldIgnoreNulls()'><b>mergingStructuredIntoRawShouldIgnoreNulls</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.mergingStucturedIntoRawShouldUpdateLatestRawConfigs()'><b>mergingStucturedIntoRawShouldUpdateLatestRawConfigs</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.strategyShouldBeCalledToLoadConfig()'><b>strategyShouldBeCalledToLoadConfig</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+<tr>
+<td title='org.rhq.core.pc.configuration.ConfigurationManagerTest.updatingConfigShouldSubmitRunnerToThreadPool()'><b>updatingConfigShouldSubmitRunnerToThreadPool</b><br>Test class:org.rhq.core.pc.configuration.ConfigurationManagerTest</td>
+<td>org.rhq.core.pc.configuration.ConfigurationManagerTest@564ac216</td><td>0</td>
+<td></td>
+</tr>
+</table><p>
+</body>
+</html>
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties
new file mode 100644
index 0000000..84fd129
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.properties
@@ -0,0 +1 @@
+[SuiteResult org.rhq.core.pc.configuration.ConfigurationManagerTest]
\ No newline at end of file
diff --git a/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml
new file mode 100644
index 0000000..a661050
--- /dev/null
+++ b/test-output/rhq/org.rhq.core.pc.configuration.ConfigurationManagerTest.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuite name="org.rhq.core.pc.configuration.ConfigurationManagerTest" failures="0" tests="10" time="0.539" errors="0">
+ <properties/>
+ <testcase name="catchExceptionThrownByFailedValidationOfRawConfigs" time="0.042" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="exceptionShouldBeThrownIfConfigIsNull" time="0.011" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="exceptionShouldBeThrownWhenStrategyThrowsAnException" time="0.008" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="mergingRawsIntoStructuredShouldIgnoreNull" time="0.093" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="mergingRawsIntoStructuredShouldUpdateLatestStructuredConfig" time="0.019" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="mergingStructuredIntoRawShouldDoNothingIfRawsAreNull" time="0.018" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="mergingStructuredIntoRawShouldIgnoreNulls" time="0.018" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="mergingStucturedIntoRawShouldUpdateLatestRawConfigs" time="0.023" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="strategyShouldBeCalledToLoadConfig" time="0.021" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+ <testcase name="updatingConfigShouldSubmitRunnerToThreadPool" time="0.09" classname="org.rhq.core.pc.configuration.ConfigurationManagerTest"/>
+</testsuite>
diff --git a/test-output/rhq/reporter-output.html b/test-output/rhq/reporter-output.html
new file mode 100644
index 0000000..063bc2e
--- /dev/null
+++ b/test-output/rhq/reporter-output.html
@@ -0,0 +1 @@
+<h2>Reporter output</h2><table></table>
\ No newline at end of file
diff --git a/test-output/rhq/testng-failed.xml b/test-output/rhq/testng-failed.xml
new file mode 100644
index 0000000..a243e55
--- /dev/null
+++ b/test-output/rhq/testng-failed.xml
@@ -0,0 +1,15 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Failed suite [rhq]" junit="false" annotations="JDK" data-provider-thread-count="10">
+ <test name="classes(failed)" junit="false" annotations="JDK">
+ <classes>
+ <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <methods>
+ <include name="initContext"/>
+ <include name="initMocks"/>
+ <include name="setup"/>
+ <include name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService"/>
+ </methods>
+ </class>
+ </classes>
+ </test>
+</suite>
diff --git a/test-output/rhq/testng.xml.html b/test-output/rhq/testng.xml.html
new file mode 100644
index 0000000..62a0d97
--- /dev/null
+++ b/test-output/rhq/testng.xml.html
@@ -0,0 +1 @@
+<html><head><title>testng.xml for rhq</title></head><body><tt><!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"><br/><suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="rhq" junit="false" annotations="JDK" data-provider-thread-count="10"><br/> <test verbose="2" name="classes" junit="false" annotations="JDK"><br/> <classes><br/> <class name="org.rhq.core.pc.configuration.MockResourceConfigurationFacet"/><br/> <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest"/><br/> </classes><br/> </test><br/></suite><br/></tt></body></html>
\ No newline at end of file
diff --git a/test-output/rhq/toc.html b/test-output/rhq/toc.html
new file mode 100644
index 0000000..6328f53
--- /dev/null
+++ b/test-output/rhq/toc.html
@@ -0,0 +1,30 @@
+<html>
+<head>
+<title>Results for rhq</title>
+<link href="../testng.css" rel="stylesheet" type="text/css" />
+<link href="../my-testng.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<h3><p align="center">Results for<br/><em>rhq</em></p></h3>
+<table border='1' width='100%'>
+<tr valign='top'>
+<td>1 test</td>
+<td><a target='mainFrame' href='classes.html'>1 class</a></td>
+<td>8 methods:<br/>
+ <a target='mainFrame' href='methods.html'>chronological</a><br/>
+ <a target='mainFrame' href='methods-alphabetical.html'>alphabetical</a><br/>
+ <a target='mainFrame' href='methods-not-run.html'>not run (0)</a></td>
+</tr>
+<tr>
+<td><a target='mainFrame' href='groups.html'>0 group</a></td>
+<td><a target='mainFrame' href='reporter-output.html'>reporter output</a></td>
+<td><a target='mainFrame' href='testng.xml.html'>testng.xml</a></td>
+</tr></table>
+<table width='100%' class='test-passed'>
+<tr><td>
+<table style='width: 100%'><tr><td valign='top'>classes (8/0/0)</td><td valign='top' align='right'>
+ <a href='classes.html' target='mainFrame'>Results</a>
+</td></tr></table>
+</td></tr><p/>
+</table>
+</body></html>
\ No newline at end of file
diff --git a/test-output/testng-failed.xml b/test-output/testng-failed.xml
new file mode 100644
index 0000000..a243e55
--- /dev/null
+++ b/test-output/testng-failed.xml
@@ -0,0 +1,15 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" name="Failed suite [rhq]" junit="false" annotations="JDK" data-provider-thread-count="10">
+ <test name="classes(failed)" junit="false" annotations="JDK">
+ <classes>
+ <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <methods>
+ <include name="initContext"/>
+ <include name="initMocks"/>
+ <include name="setup"/>
+ <include name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService"/>
+ </methods>
+ </class>
+ </classes>
+ </test>
+</suite>
diff --git a/test-output/testng-results.xml b/test-output/testng-results.xml
new file mode 100644
index 0000000..4faf1c2
--- /dev/null
+++ b/test-output/testng-results.xml
@@ -0,0 +1,76 @@
+<testng-results>
+ <reporter-output>
+ </reporter-output>
+ <suite name="rhq">
+ <groups>
+ </groups>
+ <test name="classes">
+ <class name="org.rhq.core.pc.configuration.ConfigManagementFactoryImplTest">
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="9" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="11" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeLegacyConfigMgmtWithComponentService()" name="factoryShouldInitializeLegacyConfigMgmtWithComponentService" duration-ms="51" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeLegacyConfigMgmtWithConfigurationUtilityService" duration-ms="4" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeLoadStructuredAndRawWithComponentService()" name="factoryShouldInitializeLoadStructuredAndRawWithComponentService" duration-ms="2" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService()" name="factoryShouldInitializeLoadStructuredAndRawWithConfigurationUtilityService" duration-ms="5" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeRawConfigMgmtWithComponentService()" name="factoryShouldInitializeRawConfigMgmtWithComponentService" duration-ms="5" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="1" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeRawConfigMgmtWithConfigurationUtilityService" duration-ms="16" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeStructuredConfigMgmtWithComponentService()" name="factoryShouldInitializeStructuredConfigMgmtWithComponentService" duration-ms="14" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initContext()" name="initContext" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="initMocks()" name="initMocks" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService()" name="factoryShouldInitializeStructuredConfigMgmtWithConfigurationUtilityService" duration-ms="16" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ <test-method status="PASS" signature="setup()" name="setup" is-config="true" duration-ms="0" started-at="2010-02-02T20:31:22Z" finished-at="2010-02-02T20:31:22Z">
+ </test-method>
+ </class>
+ </test>
+ </suite>
+</testng-results>
diff --git a/test-output/testng.css b/test-output/testng.css
new file mode 100644
index 0000000..3904800
--- /dev/null
+++ b/test-output/testng.css
@@ -0,0 +1,9 @@
+.invocation-failed, .test-failed { background-color: #DD0000; }
+.invocation-percent, .test-percent { background-color: #006600; }
+.invocation-passed, .test-passed { background-color: #00AA00; }
+.invocation-skipped, .test-skipped { background-color: #CCCC00; }
+
+.main-page {
+ font-size: x-large;
+}
+
commit 285dbe27561d19dea8bd1929ea3a489863463111
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 2 17:01:50 2010 -0500
Adding ResourceConfigurationEditor.undoEdit() and corresponding method in RawConfigUIBean
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 9a0fab5..5ba82bc 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -62,6 +62,10 @@ public class RawConfigUIBean {
Events.instance().raiseEvent("rawConfigUpdate", this);
}
+ public void undoEdit() {
+ rawConfiguration = originalRawConfiguration.deepCopy(false);
+ }
+
/** @return The full path name of the raw config file */
public String getPath() {
return rawConfiguration.getPath();
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 4339aef..8757de5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -171,6 +171,15 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
return null;
}
+ public void undoEdit(String path) {
+ RawConfigUIBean rawConfigUIBean = findRawConfigUIBeanByPath(path);
+ rawConfigUIBean.undoEdit();
+ }
+
+ /**
+ *
+ * @return
+ */
public String finishAddMap() {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
return "success";
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 031a6ef..b520d47 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -262,7 +262,7 @@ THIS TEXT WILL BE REMOVED.
<a4j:support event="onclick"
onsumbit="cursor_wait()"
oncomplete="cursor_clear()"
- action="#{ExistingResourceConfigurationUIBean.undoEdit(rawConfigUIBean.path)}"
+ action="#{configurationEditor.undoEdit(rawConfigUIBean.path)}"
reRender="fileMenu,fileContents"/>
</h:commandButton>
</h:panelGroup>
commit 8af8a03f6d51cfc5b0d26a8f9b5f8a22a63d0ba9
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 2 15:37:29 2010 -0500
Updating page nav rules and ResourceConfigurationEditor to support adding/editing complex properties
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index f22a56c..4339aef 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -170,4 +170,14 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
return null;
}
+
+ public String finishAddMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map added.");
+ return "success";
+ }
+
+ public String finishEditMap() {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Map updated.");
+ return "success";
+ }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 9313b60..cfdb513 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -20,6 +20,7 @@
<page view-id="/rhq/resource/configuration/edit.xhtml">
<action execute="#{configurationEditor.initialize}" on-postback="false"/>
<begin-conversation join="true"/>
+
<navigation from-action="#{configurationEditor.updateConfiguration}">
<rule if-outcome="success">
<end-conversation before-redirect="false"/>
@@ -28,6 +29,14 @@
</redirect>
</rule>
</navigation>
+
+ <navigation from-action="#{configurationEditor.finishAddMap}">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </navigation>
+
+ <navigation from-action="#{configurationEditor.finishEditMap}">
+ <render view-id="/rhq/resource/configuration/edit.xhtml"/>
+ </navigation>
</page>
</pages>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/add-map.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/add-map.xhtml
index e29844c..8253558 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/add-map.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/add-map.xhtml
@@ -27,12 +27,12 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
- <onc:config configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+ <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
listName="#{param.listName}"/>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
- <h:commandButton value="OK" type="submit" action="#{ExistingResourceConfigurationUIBean.finishAddMap}"
+ <h:commandButton value="OK" type="submit" action="#{configurationEditor.finishAddMap}"
alt="Click to Add Map" styleClass="buttonmed"/>
<h:commandButton value="RESET" type="reset" immediate="true"
alt="Click to Reset Fields" styleClass="buttonmed"/>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-map.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-map.xhtml
index 5471be2..46aaed8 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-map.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-map.xhtml
@@ -27,14 +27,14 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
- <onc:config configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+ <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
listName="#{param.listName}"
listIndex="#{param.listIndex}"
prevalidate="true"/>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
- <h:commandButton value="OK" action="#{ExistingResourceConfigurationUIBean.finishEditMap}"
+ <h:commandButton value="OK" action="#{configurationEditor.finishEditMap}"
alt="Click to Update Map" styleClass="buttonmed"/>
<h:commandButton value="RESET" type="reset" immediate="true"
alt="Click to Reset Fields" styleClass="buttonmed"/>
commit 69d8203b48bc7bbb994f71ec166b0589e051bd1e
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 2 14:49:24 2010 -0500
Adding update method to ResourceConfigurationEditor.
Also replacing more uses of ExistingResourceConfigurationUIBean with configurationEditor.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index c563385..e4e3d7e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -115,16 +115,8 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
* @param contents The new contents
*/
public void setContents(String contents) {
- if (configuration != null) {
- configuration.removeRawConfiguration(this);
- }
-
this.contents = contents;
updateSha256();
-
- if (configuration != null) {
- configuration.addRawConfiguration(this);
- }
}
private void updateSha256() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index a996407..9d43732 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -313,7 +313,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
if (editedRaw.getSha256().equals(originalRaw.getSha256())) {
--numberOfModifiedFiles;
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
- rawUIBean.setModified(false);
+// rawUIBean.setModified(false);
getModified().remove(editedRaw.getPath());
}
else {
@@ -327,8 +327,8 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
RawConfigUIBean bean = findRawConfigUIBeanByPath(path);
if (bean != null) {
- bean.setModified(false);
- bean.setIcon("/images/blank.png");
+// bean.setModified(false);
+// bean.setIcon("/images/blank.png");
}
}
@@ -496,7 +496,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
private void markCurrentRawConfigUIBeanModified() {
RawConfigUIBean bean = findRawConfigUIBeanByPath(current.getPath());
if (bean != null) {
- bean.setModified(true);
+// bean.setModified(true);
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 90ad4d3..9a0fab5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -24,6 +24,7 @@
package org.rhq.enterprise.gui.configuration.resource;
import org.jboss.seam.core.Events;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
import javax.faces.component.NamingContainer;
@@ -53,7 +54,11 @@ public class RawConfigUIBean {
}
public void setContents(String contents) {
+ Configuration configuration = rawConfiguration.getConfiguration();
+ configuration.removeRawConfiguration(rawConfiguration);
rawConfiguration.setContents(contents);
+ configuration.addRawConfiguration(rawConfiguration);
+
Events.instance().raiseEvent("rawConfigUpdate", this);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 6c7eb7f..f22a56c 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -28,11 +28,16 @@ import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
+import javax.faces.application.FacesMessage;
import java.util.HashSet;
import java.util.Set;
@@ -131,4 +136,38 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
return numberOfFilesModified + " files changed in this configuration";
}
+
+ public String updateConfiguration() {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+
+ ConfigurationMaskingUtility.unmaskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
+
+ AbstractResourceConfigurationUpdate updateRequest = configurationMgr.updateStructuredOrRawConfiguration(
+ loggedInUser.getSubject(), resourceId, resourceConfiguration, isStructuredMode());
+
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ return "success";
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ return "failure";
+ case UNSENT:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update was not valid",
+ updateRequest.getErrorMessage());
+ return "failure";
+ }
+ }
+ else {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
+ + "no update request has been sent to the Agent.");
+ return "success";
+ }
+
+ return null;
+ }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
index 3bb7c6c..3cab434 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -62,7 +62,7 @@ public class ResourceConfigurationViewer {
protected Configuration resourceConfiguration;
@Out
- private ConfigurationDefinition resourceConfigurationDefinition;
+ protected ConfigurationDefinition resourceConfigurationDefinition;
@Out
private Collection<RawConfigDirectory> rawConfigDirectories;
@@ -181,6 +181,14 @@ public class ResourceConfigurationViewer {
/** @return The currently selected tab, structured (i.e., Basic Mode) or raw (i.e., Advanced Mode). */
public String getSelectedTab() {
+ if (isStructuredSupported()) {
+ return "structuredTab";
+ }
+
+ if (isRawSupported()) {
+ return "rawTab";
+ }
+
if (mode == STRUCTURED_MODE) {
return "structuredTab";
}
@@ -213,7 +221,6 @@ public class ResourceConfigurationViewer {
protected void changeToStructuredTab() {
}
-
public void select(String path) {
selectedRawUIBean = findRawConfigUIBeanByPath(path);
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
index 126fb6f..2042013 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/components.xml
@@ -12,7 +12,7 @@
<component name="org.jboss.seam.core.init">
<property name="debug">false</property> <!-- enable only when needed -->
<property name="transactionManagementEnabled">false</property>
- <property name="jndi-pattern">rhq/#{ejbName}/local</property>
+ <property name="jndiPattern">rhq/#{ejbName}/local</property>
</component>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index b79dba9..9313b60 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -20,6 +20,14 @@
<page view-id="/rhq/resource/configuration/edit.xhtml">
<action execute="#{configurationEditor.initialize}" on-postback="false"/>
<begin-conversation join="true"/>
+ <navigation from-action="#{configurationEditor.updateConfiguration}">
+ <rule if-outcome="success">
+ <end-conversation before-redirect="false"/>
+ <redirect view-id="/rhq/resource/configuration/history.xhtml">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ </redirect>
+ </rule>
+ </navigation>
</page>
</pages>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index 0b9ab22..031a6ef 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -49,7 +49,7 @@ THIS TEXT WILL BE REMOVED.
<h:form id="editResourceConfigurationForm"
onsubmit="prepareInputsForSubmission(this)"
- rendered="#{!ViewResourceConfigurationUIBean.updateInProgress}">
+ rendered="#{!configurationEditor.updateInProgress}">
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
@@ -61,7 +61,7 @@ THIS TEXT WILL BE REMOVED.
style="padding-right:10px"
value="#{configurationEditor.modifiedFilesMsg}"/>
<h:commandButton value="Commit"
- action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ action="#{configurationEditor.updateConfiguration}"
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
@@ -70,14 +70,14 @@ THIS TEXT WILL BE REMOVED.
</h:panelGrid>
<c:choose>
- <c:when test="${ExistingResourceConfigurationUIBean.rawSupported}">
+ <c:when test="${configurationEditor.rawSupported}">
<rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
<rich:tab label="Advanced Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:panelGrid columns="2"
styleClass="raw-outer-table"
columnClasses="raw-outer-table-left-col,raw-outer-table-right-col">
<h:panelGrid columns="1">
- <rich:panel style="width:100%">
+ <rich:panel id="fileMenuPanel" style="width:100%">
<f:facet name="header">Files</f:facet>
<rich:panelMenu id="fileMenu"
@@ -89,18 +89,17 @@ THIS TEXT WILL BE REMOVED.
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
+ selectedChild="#{selectedRawUIBean.path}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
- binding="#{rawConfigUIBean.panelMenuItem}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
- action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
<h:panelGroup>
- <h:outputText value="#{#rawConfigUIBean.fileName}"/>
+ <h:outputText value="#{rawConfigUIBean.fileName}"/>
<h:commandButton value="Undo"
styleClass="buttonmed"
rendered="#{rawConfigUIBean.modified}">
@@ -131,38 +130,37 @@ THIS TEXT WILL BE REMOVED.
<h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
- <h:commandLink action="#{ExistingResourceConfigurationUIBean.download}" value="Download">
+ <h:commandLink action="#{configurationEditor.download}" value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
<a4j:status id="selectedFileHeader"
- startText="Loading #{ExistingResourceConfigurationUIBean.current.path} ..."
- stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
- value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ value="#{selectedRawUIBean.contents}"
readonly="false">
<a4j:support event="onkeyup"
ignoreDupeResponses="true"
- reRender="fileMenu"
- requestDelay="1000"
- action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
+ reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
+ requestDelay="1000"/>
</h:inputTextarea>
</rich:panel>
</h:panelGrid>
</h:panelGrid>
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
- <h:panelGroup style="text-align:right">
+ <h:panelGroup id="lowerCommitPanel" style="text-align:right">
<h:outputText value="#{configurationEditor.modifiedFilesMsg}"
rendered="#{configurationEditor .rawMode}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
- action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ action="#{configurationEditor.updateConfiguration}"
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
@@ -172,18 +170,18 @@ THIS TEXT WILL BE REMOVED.
</rich:tabPanel>
</c:when>
- <c:when test="${ExistingResourceConfigurationUIBean.structuredSupported}">
+ <c:when test="${configurationEditor.structuredSupported}">
<rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
<rich:tab label="Basic Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
- <onc:config configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationUIBean.configuration}"
- nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
- nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell"
- rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
- <h:commandButton value="SAVE" action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ rendered="#{resourceConfiguration != null}">
+ <h:commandButton value="SAVE" action="#{configurationEditor.updateConfiguration}"
title="Click to Save Changes" styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
<h:commandButton value="RESET" type="reset" immediate="true"
@@ -193,7 +191,7 @@ THIS TEXT WILL BE REMOVED.
</rich:tabPanel>
</c:when>
- <c:when test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
+ <c:when test="${configurationEditor.structuredAndRawSupported}">
<rich:tabPanel id="configTabPanel"
selectedTab="#{configurationEditor.selectedTab}"
switchType="ajax"
@@ -214,7 +212,7 @@ THIS TEXT WILL BE REMOVED.
columnClasses="button-cell"
rendered="#{resourceConfiguration != null}">
<h:commandButton value="SAVE"
- action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
+ action="#{configurationEditor.updateConfiguration}"
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
@@ -247,7 +245,7 @@ THIS TEXT WILL BE REMOVED.
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{ExistingResourceConfigurationUIBean.currentPath}">
+ selectedChild="#{selectedRawUIBean.path}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
@@ -288,14 +286,14 @@ THIS TEXT WILL BE REMOVED.
<h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
- <h:commandLink action="#{ExistingResourceConfigurationUIBean.download}" value="Download">
+ <h:commandLink action="#{configurationEditor.download}" value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
<a4j:status id="selectedFileHeader"
- startText="Loading #{ExistingResourceConfigurationUIBean.current.path} ..."
- stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
</h:panelGrid>
<rich:panel id="fileContentsPanel" style="margin-left:1px; border: none;">
@@ -318,7 +316,7 @@ THIS TEXT WILL BE REMOVED.
rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
- action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
+ action="#{configurationEditor.updateConfiguration}"
title="Click to Save Changes"
styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure}"/>
@@ -334,7 +332,7 @@ THIS TEXT WILL BE REMOVED.
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
- rendered="#{ExistingResourceConfigurationUIBean.updateInProgress}">
+ rendered="#{configurationEditor.updateInProgress}">
<b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
</h:panelGroup>
</ui:define>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 3b05ebb..889436f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -212,7 +212,7 @@ THIS TEXT WILL BE REMOVED.
var="rawConfigDir">
<rich:panelMenuGroup label="#{rawConfigDir.path}"
expanded="true"
- selectedChild="#{currentPath}">
+ selectedChild="#{selectedRawUIBean.path}">
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
icon="/images/blank.png"
commit f9777c447fd56057818b69f86a11e3ca36d0c100
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 2 17:10:48 2010 +0100
Bring back the Menu entry for alert notification templates, that somehow got lost.
diff --git a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
index 06c665b..cf81d77 100644
--- a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -481,6 +481,18 @@
</activators>
</menu-item>
+ <menu-item
+ name="administration.systemConfiguration.notifcationTemplates"
+ displayName="Alert Notification Templates"
+ url="/rhq/resource/alert/notif/notificationTemplates.xhtml">
+ <position name="administration.systemConfiguration.templates"
+ placement="after"/>
+ <activators>
+ <global-permission
+ name="MANAGE_SETTINGS"/>
+ </activators>
+ </menu-item>
+
<!-- Core Menu: administration.content -->
<menu-item
name="administration.content.contentProviders"
commit 5549466138b3b968cfb590ed6f76d1e80c4a5530
Merge: 8d13b57... 94191d5...
Author: Adam Young <ayoung(a)redhat.com>
Date: Tue Feb 2 11:02:33 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
diff --cc modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index feebd98,a996407..ebb3bc6
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@@ -40,10 -38,8 +40,9 @@@ import org.rhq.enterprise.gui.configura
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
- import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
+import javax.ejb.EJBException;
import javax.faces.application.FacesMessage;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
commit ce591d838ce5136c30d35e1cba9cdf1d5de48490
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 2 15:56:58 2010 +0100
Fix tiny error, that prevented showing the available roles
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
index 624f0d7..318e5a1 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
@@ -102,10 +102,9 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
if (currentRoles==null)
fillRolesFromAlertParameters();
- Map<String,String> ret = new HashMap<String, String>();
for (Role role : allRoles) {
String roleId = String.valueOf(role.getId());
- if (currentRoles==null || currentRoles.contains(roleId))
+ if (currentRoles==null || !currentRoles.contains(roleId))
rolesMap.put(role.getName(), roleId);
}
}
commit 42af01a4ea5b6c53bb6f433ce6113a7b2ca74c11
Author: John Sanda <john(a)localhost.localdomain>
Date: Tue Feb 2 09:21:16 2010 -0500
Refactoring methods for translating between structured and raw and for tracking changes
As part of this refactoring, introducing a new class, ResourceConfigurationViewer, which
ResourceConfigurationEditor extends. ResourceConfigurationEditor has methods to handle
translating between structured and raw.
RawConfigUIBean has been refactored such that it encapsulates logic to determinr whether
or not the corresponding raw config file is modified. When the file is modified,
RawConfigUIBean fires a seam event to inidicate that the file has been updated.
ResourceConfigurationEditor subscribes to the event fired by RawConfigUIBean. The event
handler method contains logic for tracking the files that are modified.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
index e4e3d7e..c563385 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/RawConfiguration.java
@@ -115,8 +115,16 @@ public class RawConfiguration implements Serializable, DeepCopyable<RawConfigura
* @param contents The new contents
*/
public void setContents(String contents) {
+ if (configuration != null) {
+ configuration.removeRawConfiguration(this);
+ }
+
this.contents = contents;
updateSha256();
+
+ if (configuration != null) {
+ configuration.addRawConfiguration(this);
+ }
}
private void updateSha256() {
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
index fe346dd..953f0fa 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigDirectory.java
@@ -48,8 +48,6 @@ public class RawConfigDirectory {
}
public void addRawConfig(RawConfiguration rawConfig) {
- RawConfigUIBean bean = new RawConfigUIBean();
- bean.setRawConfiguration(rawConfig);
- rawConfigUIBeans.add(bean);
+ rawConfigUIBeans.add(new RawConfigUIBean(rawConfig));
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 260921d..90ad4d3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -23,53 +23,29 @@
package org.rhq.enterprise.gui.configuration.resource;
+import org.jboss.seam.core.Events;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.richfaces.component.html.HtmlPanelMenuItem;
import javax.faces.component.NamingContainer;
import java.io.File;
public class RawConfigUIBean {
- private RawConfiguration rawConfiguration;
-
- private boolean modified;
+ private RawConfiguration originalRawConfiguration;
- private String modifiedContents;
-
- private HtmlPanelMenuItem panelMenuItem;
+ private RawConfiguration rawConfiguration;
- public RawConfiguration getRawConfiguration() {
- return rawConfiguration;
+ public RawConfigUIBean(RawConfiguration rawConfiguration) {
+ this.rawConfiguration = rawConfiguration;
+ originalRawConfiguration = rawConfiguration.deepCopy(false);
}
public void setRawConfiguration(RawConfiguration rawConfiguration) {
this.rawConfiguration = rawConfiguration;
}
- public HtmlPanelMenuItem getPanelMenuItem() {
- return panelMenuItem;
- }
-
- public void setPanelMenuItem(HtmlPanelMenuItem panelMenuItem) {
- this.panelMenuItem = panelMenuItem;
- }
-
- public String getModifiedContents() {
- return modifiedContents;
- }
-
- public void setModifiedContents(String contents) {
- modifiedContents = contents;
- }
-
public boolean isModified() {
- return modified;
- }
-
- public void setModified(boolean modified) {
- this.modified = modified;
- panelMenuItem.setIcon(getIcon());
+ return !rawConfiguration.getSha256().equals(originalRawConfiguration.getSha256());
}
public String getContents() {
@@ -78,6 +54,7 @@ public class RawConfigUIBean {
public void setContents(String contents) {
rawConfiguration.setContents(contents);
+ Events.instance().raiseEvent("rawConfigUpdate", this);
}
/** @return The full path name of the raw config file */
@@ -106,7 +83,4 @@ public class RawConfigUIBean {
return "/images/blank.png";
}
- public void setIcon(String icon) {
- panelMenuItem.setIcon(icon);
- }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 9e5b695..6c7eb7f 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -24,228 +24,111 @@
package org.rhq.enterprise.gui.configuration.resource;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.RawConfiguration;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
-import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
-import org.rhq.core.gui.util.FacesContextUtility;
-import org.rhq.enterprise.gui.legacy.WebUser;
-import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import javax.faces.event.ValueChangeEvent;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.*;
+import java.util.HashSet;
+import java.util.Set;
@Name("configurationEditor")
@Scope(ScopeType.CONVERSATION)
-@Role(name = "configurationViewer", scope = ScopeType.PAGE)
-public class ResourceConfigurationEditor {
-
- private static final boolean STRUCTURED_MODE = true;
- private static final boolean RAW_MODE = false;
-
- private boolean mode = STRUCTURED_MODE;
+public class ResourceConfigurationEditor extends ResourceConfigurationViewer {
private Configuration originalResourceConfiguration;
- @In("webUser")
- private WebUser loggedInUser;
-
- @Out
- private Configuration resourceConfiguration;
-
- @Out
- private ConfigurationDefinition resourceConfigurationDefinition;
+ private int numberOfFilesModified;
- @Out
- private Collection<RawConfigDirectory> rawConfigDirectories;
-
- @Out(required = false)
- private RawConfigUIBean selectedRawUIBean;
-
- @RequestParameter("id")
- private int resourceId;
+ private Set<String> modifiedFiles = new HashSet<String>();
@RequestParameter
private String tab;
- private boolean readOnly = true;
-
- @Create
- public void initialize() {
- loadResourceConfigurationDefinition();
- loadResourceConfiguration();
- initRawConfigDirectories();
-
+ @Override
+ protected void doInitialization() {
if (tab != null) {
setSelectedTab(tab);
}
- }
-
- private void loadResourceConfigurationDefinition() {
- int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
-
- resourceConfigurationDefinition = configurationManager.getResourceConfigurationDefinitionForResourceType(
- loggedInUser.getSubject(), resourceTypeId);
+ originalResourceConfiguration = resourceConfiguration.deepCopy(true);
}
- private void loadResourceConfiguration() {
- Subject subject = loggedInUser.getSubject();
-
- ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
-
- AbstractResourceConfigurationUpdate configurationUpdate =
- configurationManager.getLatestResourceConfigurationUpdate(subject, resourceId);
- resourceConfiguration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
-
- if (resourceConfiguration != null) {
- ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
+ @Override
+ protected void changeToRawTab() {
+ resourceConfiguration = translateToRaw();
+// initRawConfigDirectories();
+ for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
+ RawConfigUIBean uiBean = findRawConfigUIBeanByPath(raw.getPath());
+ uiBean.setRawConfiguration(raw);
}
-
}
- private void initRawConfigDirectories() {
- if (isRawSupported() || isStructuredAndRawSupported()) {
- initConfigDirectories();
- }
- else {
- rawConfigDirectories = Collections.EMPTY_LIST;
- }
+ private Configuration translateToRaw() {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ return configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
+ resourceConfiguration, STRUCTURED_MODE);
}
- private void initConfigDirectories() {
- Map<String, RawConfigDirectory> dirs = new TreeMap<String, RawConfigDirectory>();
-
- for (RawConfiguration rawConfig : resourceConfiguration.getRawConfigurations()) {
- String parentDirPath = getParentDir(rawConfig);
- RawConfigDirectory dir = dirs.get(parentDirPath);
+ @Override
+ protected void changeToStructuredTab() {
+ resourceConfiguration = translateToStructured();
+ }
- if (dir == null) {
- dir = new RawConfigDirectory();
- dir.setPath(parentDirPath);
+ private Configuration translateToStructured() {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ return configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
+ resourceConfiguration, RAW_MODE);
+ }
+
+ @Observer("rawConfigUpdate")
+ public void rawConfigUpdated(RawConfigUIBean rawConfigUIBean) {
+ if (rawConfigUIBean.isModified()) {
+ // If the file is modified and not already in the cache, then the file was previously in an unmodified state
+ // so we want to increment the number of files modified and put the file in the cache to track its current
+ // state.
+ if (!modifiedFiles.contains(rawConfigUIBean.getPath())) {
+ modifiedFiles.add(rawConfigUIBean.getPath());
+ ++numberOfFilesModified;
}
-
- dir.addRawConfig(rawConfig);
- dirs.put(parentDirPath, dir);
- }
-
- rawConfigDirectories = dirs.values();
-
- RawConfigDirectory selectedDir = null;
- for (RawConfigDirectory dir : rawConfigDirectories) {
- selectedDir = dir;
- break;
+ // There is kind of an implicit else block to do nothing. If the file is modified and already in the cache,
+ // then that means we have already incremented the number of files modified, so we do not need to
+ // increment again.
}
- selectedRawUIBean = selectedDir.getRawConfigUIBeans().get(0);
- }
-
- private String getParentDir(RawConfiguration rawConfig) {
- File file = new File(rawConfig.getPath());
- return file.getParentFile().getAbsolutePath();
- }
-
- public boolean isReadOnly() {
- return readOnly;
- }
-
- public void setReadOnly(boolean readOnly) {
- this.readOnly = readOnly;
- }
-
- public boolean isRawSupported() {
- return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.RAW;
- }
-
- public boolean isStructuredSupported() {
- return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED;
- }
-
- public boolean isStructuredAndRawSupported() {
- return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
- }
-
- public String getSelectedTab() {
- if (mode == STRUCTURED_MODE) {
- return "structuredTab";
+ else if (modifiedFiles.contains(rawConfigUIBean.getPath())) {
+ // We fall into this block if the file is not modified and if the cache contains the file, which means it
+ // was previously in a modified state; therefore, we remove it from the cache, and decrement the number of
+ // files modified.
+ modifiedFiles.remove(rawConfigUIBean.getPath());
+ --numberOfFilesModified;
}
- return "rawTab";
}
- public void setSelectedTab(String tab) {
- if (tab.equals("structuredTab")) {
- mode = STRUCTURED_MODE;
- }
- else {
- mode = RAW_MODE;
+ public boolean isDisplayChangedFilesLabel() {
+ if (isStructuredMode()) {
+ return false;
}
- }
- public void changeTabs(ValueChangeEvent event) {
- if (event.getNewValue().equals("rawTab")) {
-// switchToRaw();
- mode = RAW_MODE;
- }
- else if (event.getNewValue().equals("structuredTab")) {
-// switchToStructured();
- mode = STRUCTURED_MODE;
+ if (isRawSupported()) {
+ return true;
}
- }
- public void edit() {
- originalResourceConfiguration = resourceConfiguration.deepCopy(true);
- }
-
- public void select(String path) {
- selectedRawUIBean = findRawConfigUIBeanByPath(path);
+ return isRawMode();
}
- private RawConfigUIBean findRawConfigUIBeanByPath(String path) {
- for (RawConfigDirectory dir : rawConfigDirectories) {
- for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
- if (bean.getPath().equals(path)) {
- return bean;
- }
- }
+ public String getModifiedFilesMsg() {
+ if (!isDisplayChangedFilesLabel() || numberOfFilesModified == 0) {
+ return "";
}
- return null;
- }
-
- public boolean isUpdateInProgress() {
- ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
- return configurationMgr.isResourceConfigurationUpdateInProgress(loggedInUser.getSubject(), resourceId);
- }
-
- public String download() {
- try {
- File file = new File(selectedRawUIBean.getFileName());
-
- HttpServletResponse response = FacesContextUtility.getResponse();
- response.setHeader("Content-Disposition", "attachment;filename=" + file.getName());
- OutputStream ostream = response.getOutputStream();
- ostream.write(selectedRawUIBean.getContents().getBytes());
- ostream.flush();
- ostream.close();
-
- FacesContextUtility.getFacesContext().responseComplete();
- return null;
+ if (numberOfFilesModified == 1) {
+ return "1 file changed in this configuration";
}
- catch (IOException e) {
-// log.error("Failed to complete download request for " + getCurrentPath(), e);
- throw new RuntimeException(e);
- }
- }
+ return numberOfFilesModified + " files changed in this configuration";
+ }
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
new file mode 100644
index 0000000..3bb7c6c
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationViewer.java
@@ -0,0 +1,258 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.enterprise.gui.configuration.resource;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.legacy.WebUser;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.*;
+
+@Name("configurationViewer")
+(a)Scope(ScopeType.PAGE)
+public class ResourceConfigurationViewer {
+
+ public static final boolean STRUCTURED_MODE = true;
+ public static final boolean RAW_MODE = false;
+
+ private boolean mode = STRUCTURED_MODE;
+
+ @In("webUser")
+ protected WebUser loggedInUser;
+
+ @Out
+ protected Configuration resourceConfiguration;
+
+ @Out
+ private ConfigurationDefinition resourceConfigurationDefinition;
+
+ @Out
+ private Collection<RawConfigDirectory> rawConfigDirectories;
+
+ @Out(required = false)
+ private RawConfigUIBean selectedRawUIBean;
+
+ @RequestParameter("id")
+ protected int resourceId;
+
+ /**
+ * This method "bootstraps" the viewer/editor and the model objects used in the view. Specifically, the resource
+ * configuration and the corresponding configuration definition are loaded from the database and are outjected for
+ * use in the view.
+ */
+ @Create
+ public void initialize() {
+ loadResourceConfigurationDefinition();
+ loadResourceConfiguration();
+ initRawConfigDirectories();
+
+ doInitialization();
+ }
+
+ protected void doInitialization() {
+ }
+
+ private void loadResourceConfigurationDefinition() {
+ int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ resourceConfigurationDefinition = configurationManager.getResourceConfigurationDefinitionForResourceType(
+ loggedInUser.getSubject(), resourceTypeId);
+ }
+
+ private void loadResourceConfiguration() {
+ Subject subject = loggedInUser.getSubject();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ AbstractResourceConfigurationUpdate configurationUpdate =
+ configurationManager.getLatestResourceConfigurationUpdate(subject, resourceId);
+ resourceConfiguration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+
+ if (resourceConfiguration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
+ }
+
+ }
+
+ protected void initRawConfigDirectories() {
+ if (isRawSupported() || isStructuredAndRawSupported()) {
+ initConfigDirectories();
+ }
+ else {
+ rawConfigDirectories = Collections.EMPTY_LIST;
+ }
+ }
+
+ private void initConfigDirectories() {
+ Map<String, RawConfigDirectory> dirs = new TreeMap<String, RawConfigDirectory>();
+
+ for (RawConfiguration rawConfig : resourceConfiguration.getRawConfigurations()) {
+ String parentDirPath = getParentDir(rawConfig);
+ RawConfigDirectory dir = dirs.get(parentDirPath);
+
+ if (dir == null) {
+ dir = new RawConfigDirectory();
+ dir.setPath(parentDirPath);
+ }
+
+ dir.addRawConfig(rawConfig);
+ dirs.put(parentDirPath, dir);
+ }
+
+ rawConfigDirectories = dirs.values();
+
+ RawConfigDirectory selectedDir = null;
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ selectedDir = dir;
+ break;
+ }
+ selectedRawUIBean = selectedDir.getRawConfigUIBeans().get(0);
+ }
+
+ private String getParentDir(RawConfiguration rawConfig) {
+ File file = new File(rawConfig.getPath());
+ return file.getParentFile().getAbsolutePath();
+ }
+
+ /** @return <code>true</code> if the resource configuration supports raw only, <code>false</code> otherwise */
+ public boolean isRawSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.RAW;
+ }
+
+ /** @return <code>true</code> if the resource configuration supports structured only, <code>false</code> otherwise */
+ public boolean isStructuredSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED;
+ }
+
+ public boolean isStructuredMode() {
+ return mode == STRUCTURED_MODE;
+ }
+
+ public boolean isRawMode() {
+ return mode == RAW_MODE;
+ }
+
+ /**
+ * @return <code>true</code> if the resource configuration supports structured and raw, <code>false</code> otherwise
+ */
+ public boolean isStructuredAndRawSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
+ }
+
+ /** @return The currently selected tab, structured (i.e., Basic Mode) or raw (i.e., Advanced Mode). */
+ public String getSelectedTab() {
+ if (mode == STRUCTURED_MODE) {
+ return "structuredTab";
+ }
+ return "rawTab";
+ }
+
+ public void setSelectedTab(String tab) {
+ if (tab.equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ }
+ else {
+ mode = RAW_MODE;
+ }
+ }
+
+ public void changeTabs(ValueChangeEvent event) {
+ if (event.getNewValue().equals("rawTab")) {
+ mode = RAW_MODE;
+ changeToRawTab();
+ }
+ else if (event.getNewValue().equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ changeToStructuredTab();
+ }
+ }
+
+ protected void changeToRawTab() {
+ }
+
+ protected void changeToStructuredTab() {
+ }
+
+
+ public void select(String path) {
+ selectedRawUIBean = findRawConfigUIBeanByPath(path);
+ }
+
+ protected RawConfigUIBean findRawConfigUIBeanByPath(String path) {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ if (bean.getPath().equals(path)) {
+ return bean;
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isUpdateInProgress() {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ return configurationMgr.isResourceConfigurationUpdateInProgress(loggedInUser.getSubject(), resourceId);
+ }
+
+ public String download() {
+ try {
+ File file = new File(selectedRawUIBean.getFileName());
+
+ HttpServletResponse response = FacesContextUtility.getResponse();
+ response.setHeader("Content-Disposition", "attachment;filename=" + file.getName());
+ OutputStream ostream = response.getOutputStream();
+ ostream.write(selectedRawUIBean.getContents().getBytes());
+ ostream.flush();
+ ostream.close();
+
+ FacesContextUtility.getFacesContext().responseComplete();
+
+ return null;
+ }
+ catch (IOException e) {
+// log.error("Failed to complete download request for " + getCurrentPath(), e);
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index ba713eb..0b9ab22 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -57,9 +57,9 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup id="upperCommitPanel" style="text-align:right">
<h:outputText id="changedFilesLabel"
- rendered="#{ExistingResourceConfigurationUIBean.displayChangedFilesLabel}"
+ rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"
- value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"/>
+ value="#{configurationEditor.modifiedFilesMsg}"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
title="Click to Save Changes"
@@ -158,8 +158,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:outputText value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"
- rendered="#{ExistingResourceConfigurationUIBean.rawMode}"
+ <h:outputText value="#{configurationEditor.modifiedFilesMsg}"
+ rendered="#{configurationEditor .rawMode}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
@@ -197,22 +197,22 @@ THIS TEXT WILL BE REMOVED.
<rich:tabPanel id="configTabPanel"
selectedTab="#{configurationEditor.selectedTab}"
switchType="ajax"
- valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
+ valueChangeListener="#{configurationEditor.changeTabs}">
<rich:tab id="structuredTab"
label="Basic Mode"
reRender="fileUpload,upperCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
- <onc:config configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationUIBean.configuration}"
- nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
- nullConfigurationMessage="#{ExistingResourceConfigurationUIBean.nullConfigurationMessage}"
+ <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
<h:panelGrid columns="2"
styleClass="buttons-table"
columnClasses="button-cell"
- rendered="#{ExistingResourceConfigurationUIBean.configuration != null}">
+ rendered="#{resourceConfiguration != null}">
<h:commandButton value="SAVE"
action="#{ExistingResourceConfigurationUIBean.updateConfiguration}"
title="Click to Save Changes"
@@ -227,7 +227,7 @@ THIS TEXT WILL BE REMOVED.
</rich:tab>
<rich:tab id="rawTab"
label="Advanced Mode"
- reRender="fileUpload,upperCommitPanel,lowerCommitPanel"
+ reRender="fileUpload,fileMenuPanel,upperCommitPanel,lowerCommitPanel"
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();">
<h:panelGrid columns="2"
@@ -251,10 +251,9 @@ THIS TEXT WILL BE REMOVED.
<c:forEach items="#{rawConfigDir.rawConfigUIBeans}" var="rawConfigUIBean">
<rich:panelMenuItem label="#{rawConfigUIBean.fileName}"
icon="#{rawConfigUIBean.icon}"
- binding="#{rawConfigUIBean.panelMenuItem}"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
- action="#{ExistingResourceConfigurationUIBean.select(rawConfigUIBean.path)}"
+ action="#{configurationEditor.select(rawConfigUIBean.path)}"
limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu">
<h:panelGroup>
@@ -302,13 +301,12 @@ THIS TEXT WILL BE REMOVED.
<rich:panel id="fileContentsPanel" style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
- value="#{ExistingResourceConfigurationUIBean.currentContents}"
+ value="#{selectedRawUIBean.contents}"
readonly="false">
<a4j:support event="onkeyup"
ignoreDupeResponses="true"
- reRender="fileMenu,upperCommitPanel,lowerCommitPanel"
- requestDelay="1000"
- action="#{ExistingResourceConfigurationUIBean.editCurrent}"/>
+ reRender="fileMenuPanel,upperCommitPanel,lowerCommitPanel"
+ requestDelay="1000"/>
</h:inputTextarea>
</rich:panel>
</h:panelGrid>
@@ -316,8 +314,8 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup id="lowerCommitPanel" style="text-align:right">
- <h:outputText value="#{ExistingResourceConfigurationUIBean.modifiedFilesMsg}"
- rendered="#{ExistingResourceConfigurationUIBean.rawMode}"
+ <h:outputText value="#{configurationEditor.modifiedFilesMsg}"
+ rendered="#{configurationEditor.displayChangedFilesLabel}"
style="padding-right:10px"/>
<h:commandButton value="Commit"
action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
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 6d7b3f5..ed97f48 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
@@ -50,7 +50,7 @@ class RawServer implements ResourceComponent, ResourceConfigurationFacet {
rawConfig.createNewFile()
rawConfig.withWriter { writer ->
- properties.each { key, value -> writer.writeLine("${key}=${value}") }
+ properties.each { key, value -> writer.writeLine("${key} = ${value}") }
}
}
diff --git a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
index f1a0455..a20901e 100644
--- a/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
+++ b/modules/plugins/raw-config-test/src/main/groovy/org/rhq/plugins/test/rawconfig/StructuredAndRawServer.groovy
@@ -64,7 +64,7 @@ class StructuredAndRawServer implements ResourceComponent, ResourceConfiguration
def addProperties(File rawConfig, Map properties) {
rawConfig.createNewFile()
rawConfig.withWriter {writer ->
- properties.each {key, value -> writer.writeLine("${key}=${value}") }
+ properties.each {key, value -> writer.writeLine("${key} = ${value}") }
}
}
commit b5e2ac63cbd00125516d87926d18bf450a54e149
Merge: 8353b50... 2317d89...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 2 14:09:17 2010 +0100
Merge branch 'master' into alertPlugin
commit 8353b50d7811a3562c0f23d603a55ebc38cb5977
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 2 12:43:49 2010 +0100
Model roles sender after subject sender custom ui. Plus some cleanup.
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
index d577120..624f0d7 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
@@ -20,44 +20,57 @@ package org.rhq.enterprise.server.plugins.alertRoles;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jboss.seam.annotations.Create;
-import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.util.LookupUtil;
/**
- *
+ * Backing Bean for the roles sender alert sender plugin custom UI
* @author Heiko W. Rupp
*/
+@SuppressWarnings("unused")
public class RolesBackingBean extends CustomAlertSenderBackingBean {
+ private List<Role> allRoles;
+
private Map<String, String> rolesMap;
private List<String> currentRoles;
+ private List<String> rolesToRemove;
+ private static final String ROLE_ID = "roleId";
@Create
public void init() {
- getRolesMap();
+
+ getAllRoles();
+
+ getSelectableRolesMap();
fillRolesFromAlertParameters();
}
+ private void getAllRoles() {
+ RoleManagerLocal mgr = LookupUtil.getRoleManager();
+ allRoles = mgr.findRoles(new PageControl());
+ }
+
private void fillRolesFromAlertParameters() {
- String rolesString = alertParameters.getSimpleValue("roleId","");
+ String rolesString = alertParameters.getSimpleValue(ROLE_ID,"");
String[] roles = rolesString.split(",");
+ if (roles.length==0)
+ return;
+
if (currentRoles==null)
currentRoles = new ArrayList<String>();
- for (String r : roles)
- currentRoles.add(r);
+ currentRoles.addAll(Arrays.asList(roles));
}
public List<String> getCurrentRoles() {
@@ -70,25 +83,56 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
this.currentRoles = currentRoles;
}
- public Map<String, String> getRolesMap() {
- if (this.rolesMap == null) {
- this.rolesMap = new HashMap<String, String>();
+ public List<String> getRolesToRemove() {
+ return rolesToRemove;
+ }
+
+ public void setRolesToRemove(List<String> rolesToRemove) {
+ this.rolesToRemove = rolesToRemove;
+ }
+
+ public Map<String, String> getSelectableRolesMap() {
- RoleManagerLocal mgr = LookupUtil.getRoleManager();
- PageList<Role> rolesList = mgr.findRoles(new PageControl());
+ if (rolesMap == null) {
+ rolesMap = new HashMap<String, String>();
- for (Role role : rolesList) {
- // TODO filter out all resources role
- this.rolesMap.put(role.getName(), role.getId().toString());
+ if (allRoles==null)
+ getAllRoles();
+
+ if (currentRoles==null)
+ fillRolesFromAlertParameters();
+
+ Map<String,String> ret = new HashMap<String, String>();
+ for (Role role : allRoles) {
+ String roleId = String.valueOf(role.getId());
+ if (currentRoles==null || currentRoles.contains(roleId))
+ rolesMap.put(role.getName(), roleId);
}
}
-
return this.rolesMap;
}
- public String submit() {
+ public Map<String, String> getCurrentRolesMap() {
+
+ Map<String,String> ret = new HashMap<String, String>();
+ if (currentRoles==null)
+ return ret;
+
+ for (Role role:allRoles) {
+ String roleId = String.valueOf(role.getId());
+ if (currentRoles.contains(roleId))
+ ret.put(role.getName(), roleId);
+ }
+ return ret;
+
+ }
+
+ public String addRoles() {
+
+ System.out.println("Selected roles: " + currentRoles );
+ if (currentRoles.isEmpty())
+ return "ALERT_NOTIFICATION";
- System.out.println("Selected roles: ");
String roles="";
for (String role : currentRoles) {
System.out.println(role);
@@ -98,9 +142,9 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
if (roles.endsWith(","))
roles = roles.substring(0,roles.length()-1);
- PropertySimple p = alertParameters.getSimple("roleId");
+ PropertySimple p = alertParameters.getSimple(ROLE_ID);
if (p==null) {
- p = new PropertySimple("roleId",roles);
+ p = new PropertySimple(ROLE_ID,roles);
alertParameters.put(p);
}
else
@@ -113,4 +157,38 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
return "ALERT_NOTIFICATIONS";
}
+ public String removeRoles() {
+ System.out.println("In remove roles, " + rolesToRemove);
+
+ String roles ="";
+ List<String> resulting = new ArrayList<String>(currentRoles);
+ resulting.removeAll(rolesToRemove);
+
+ for (String subject : resulting) {
+ System.out.println(subject);
+ roles += subject;
+ roles += ",";
+ }
+
+ if (roles.endsWith(","))
+ roles = roles.substring(0, roles.length()-1);
+
+ PropertySimple p = alertParameters.getSimple(ROLE_ID);
+ if (p==null) {
+ if (!resulting.isEmpty()) {
+ p = new PropertySimple(ROLE_ID, roles);
+ alertParameters.put(p);
+ }
+ }
+ else
+ p.setStringValue(roles);
+
+ alertParameters = persistConfiguration(alertParameters);
+
+ currentRoles = resulting;
+
+ fillRolesFromAlertParameters();
+
+ return "ALERT_NOTIFICATIONS";
+ }
}
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
index 759b820..f031b51 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
@@ -5,7 +5,6 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
xmlns:a4j="https://richfaces.org/a4j"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
@@ -15,23 +14,37 @@
<h:panelGroup>
<h:outputText value="Select the roles to add:" />
<br/>
-
-
- <h:selectManyListbox id="mySenderList" value="#{rolesBean.currentRoles}">
- <f:selectItems value="#{rolesBean.rolesMap}"/>
+ <h:selectManyListbox id="availableRolesList"
+ value="#{rolesBean.currentRoles}"
+ style="width : 100px"
+ size="3">
+ <f:selectItems value="#{rolesBean.selectableRolesMap}"/>
</h:selectManyListbox>
</h:panelGroup>
<h:panelGroup>
<br />
- <h:commandButton id="roles_submit"
+ <h:commandButton id="roles_submit_add"
value="Add Roles"
type="submit"
- action="#{rolesBean.submit}" />
+ action="#{rolesBean.addRoles}" />
+ <br />
+ <h:commandButton id="roles_submit_remove"
+ value="Remove Roles"
+ type="submit"
+ action="#{rolesBean.removeRoles}" />
</h:panelGroup>
<h:panelGroup>
- <h:outputText value="#{rolesBean.currentRoles}"/>
+ <h:outputText>Selected roles:</h:outputText>
+ <br/>
+ <h:selectManyListbox id="selectedRolesList"
+ value="#{rolesBean.rolesToRemove}"
+ style="width : 100px"
+ size="3">
+ <f:selectItems value="#{rolesBean.currentRolesMap}"/>
+ </h:selectManyListbox>
+
</h:panelGroup>
</h:panelGrid>
</body>
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index 23792a9..758c731 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -40,6 +40,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* Backing Bean for the subjects sender alert sender plugin custom UI
* @author Heiko W. Rupp
*/
+@SuppressWarnings("unused")
public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
private final Log log = LogFactory.getLog(SubjectsBackingBean.class);
@@ -49,7 +50,6 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
private Map<String, String> subjectsMap;
private List<String> currentSubjects;
private List<String> subjectsToRemove;
- private List<String> subjectsToAdd;
private static final String SUBJECT_ID = "subjectId";
@Create
@@ -95,13 +95,6 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
this.subjectsToRemove = subjectsToRemove;
}
- public List<String> getSubjectsToAdd() {
- return subjectsToAdd;
- }
-
- public void setSubjectsToAdd(List<String> subjectsToAdd) {
- this.subjectsToAdd = subjectsToAdd;
- }
public Map<String, String> getSelectableSubjectsMap() {
@@ -114,7 +107,6 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
if (currentSubjects==null)
fillSubjectsFromAlertParameters();
- Map<String,String> ret = new HashMap<String, String>();
for (Subject subject : allSubjects) {
String subjectId = String.valueOf(subject.getId());
if (currentSubjects==null || !currentSubjects.contains(subjectId)) {
@@ -133,8 +125,9 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
return ret;
for (Subject subject:allSubjects) {
- if (currentSubjects.contains(String.valueOf(subject.getId())))
- ret.put(subject.getName(),String.valueOf(subject.getId()) );
+ String subjectId = String.valueOf(subject.getId());
+ if (currentSubjects.contains(subjectId))
+ ret.put(subject.getName(), subjectId);
}
return ret;
commit 3f765c8bc541f434646684e4e135bd0143fe90a2
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Tue Feb 2 12:42:50 2010 +0100
Add scriptlang alert sender plugin and fix its pom to include the domain jar
diff --git a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
index 0932415..cfbe378 100644
--- a/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
+++ b/modules/enterprise/server/plugins/alert-scriptlang/pom.xml
@@ -28,6 +28,13 @@
<dependencies>
<dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope> <!-- by ear -->
+ </dependency>
+
+ <dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server</artifactId>
<version>${project.version}</version>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index d9b612e..5c35d56 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -45,6 +45,7 @@
<module>alert-mobicents</module>
<module>alert-microblog</module>
<module>alert-roles</module>
+ <module>alert-scriptlang</module>
<module>alert-snmp</module>
<module>alert-subject</module>
<module>cobbler</module>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index a48ac7b..fd3a3f2 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -48,6 +48,7 @@
<pathelement location="../alert-microblog/target/alert-microblog-${project.version}.jar" />
<pathelement location="../alert-mobicents/target/alert-mobicents-${project.version}.jar" />
<pathelement location="../alert-roles/target/alert-roles-${project.version}.jar" />
+ <pathelement location="../alert-scriptlang/target/alert-scriptlang-${project.version}.jar" />
<pathelement location="../alert-snmp/target/alert-snmp-${project.version}.jar" />
<pathelement location="../alert-subject/target/alert-subject-${project.version}.jar" />
<pathelement location="../cobbler/target/cobbler-${project.version}.jar" />
commit e610b55bd0c397b676766c6c31fa5bd3b20ad259
Author: John Sanda <john(a)localhost.localdomain>
Date: Mon Feb 1 16:19:24 2010 -0500
Updating lower edit button on view.xhtml so that you are sent to the same tab on edit.xhtml.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 4ad0606..9e5b695 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -4,17 +4,21 @@
* 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.
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
*
* 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.
+ * GNU General Public License and the GNU Lesser 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.
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.rhq.enterprise.gui.configuration.resource;
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 59645e9..3b05ebb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -48,18 +48,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
-
<s:button id="upperEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
<f:param name="id" value="#{ResourceUIBean.id}"/>
<f:param name="tab" value="#{configurationViewer.selectedTab}"/>
</s:button>
-
- <ui:remove>
- <h:commandButton value="Edit"
- action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
- </ui:remove>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
@@ -131,10 +123,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:commandButton value="Edit"
- action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
+ <s:button id="lowerEditRawButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -158,10 +150,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:commandButton value="Edit"
- action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
+ <s:button id="lowerEditStructuredButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -177,7 +169,7 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,fileUpload,upperCommitPanel,lowerCommitPanel">
+ reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton,fileUpload,upperCommitPanel,lowerCommitPanel">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -191,10 +183,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:commandButton value="Edit"
- action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
+ <s:button id="lowerEditStructuredButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -203,7 +195,7 @@ THIS TEXT WILL BE REMOVED.
onlabelclick="cursor_wait();"
oncomplete="cursor_clear();"
limitToList="true"
- reRender="upperEditButton,fileUpload,upperCommitPanel,lowerCommitPanel">
+ reRender="upperEditButton,lowerEditStructuredButton,lowerEditRawButton,fileUpload,upperCommitPanel,lowerCommitPanel">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -264,10 +256,10 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
- <h:commandButton value="Edit"
- action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
+ <s:button id="lowerEditRawButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
commit 8493e6aede2b0df31fc7f4beb6bdd30829570cce
Merge: 05f2d8e... 11c2a84...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 1 22:01:35 2010 +0100
Merge branch 'master' into alertPlugin
commit 05f2d8e5706d91036fe1c543af1eca35f7f61a72
Merge: d05f482... 2e7221e...
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 1 21:50:18 2010 +0100
Merge branch 'master' into alertPlugin
commit d05f482ac6054d5b2f79a7322acee0c251a2e0b1
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 1 21:38:34 2010 +0100
Adding an empty list does not remove the existing ones anymore.
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index 2b9f507..23792a9 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -142,7 +142,10 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
public String addSubjects() {
- System.out.println("Selected subjects: ");
+ System.out.println("Selected subjects: " + currentSubjects);
+ if (currentSubjects.isEmpty())
+ return "ALERT_NOTIFICATIONS";
+
String subjects="";
for (String subject : currentSubjects) {
System.out.println(subject);
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
index 246b1d9..13c3855 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
@@ -40,6 +40,8 @@
</h:panelGroup>
<h:panelGroup>
+ <h:outputText>Selected subjects:</h:outputText>
+ <br/>
<h:selectManyListbox id="selectedSubjectsList"
value="#{subjectsBean.subjectsToRemove}"
style="width : 100px"
commit 564bacb7fdd83e620da851a5cae5b8bbd98f5c0d
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Mon Feb 1 21:20:46 2010 +0100
We can now add and remove subjects succesfully.
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index 5af59ca..2b9f507 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -19,10 +19,10 @@
package org.rhq.enterprise.server.plugins.alertSubject;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -32,7 +32,6 @@ import org.jboss.seam.annotations.Create;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -45,23 +44,37 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
private final Log log = LogFactory.getLog(SubjectsBackingBean.class);
+ private List<Subject> allSubjects;
+
private Map<String, String> subjectsMap;
private List<String> currentSubjects;
+ private List<String> subjectsToRemove;
+ private List<String> subjectsToAdd;
private static final String SUBJECT_ID = "subjectId";
@Create
public void init() {
- getSubjectsMap();
+
+ getAllSubjects();
+
+ getSelectableSubjectsMap();
fillSubjectsFromAlertParameters();
}
+ private void getAllSubjects() {
+ SubjectManagerLocal mgr = LookupUtil.getSubjectManager();
+ allSubjects = mgr.findAllSubjects(new PageControl());
+ }
+
private void fillSubjectsFromAlertParameters() {
String rolesString = alertParameters.getSimpleValue(SUBJECT_ID,"");
String[] subjects = rolesString.split(",");
+ if (subjects.length==0)
+ return;
+
if (currentSubjects==null)
currentSubjects = new ArrayList<String>();
- for (String r : subjects)
- currentSubjects.add(r);
+ currentSubjects.addAll(Arrays.asList(subjects));
}
public List<String> getCurrentSubjects() {
@@ -74,26 +87,62 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
this.currentSubjects = currentSubjects;
}
- public Map<String, String> getSubjectsMap() {
+ public List<String> getSubjectsToRemove() {
+ return subjectsToRemove;
+ }
+
+ public void setSubjectsToRemove(List<String> subjectsToRemove) {
+ this.subjectsToRemove = subjectsToRemove;
+ }
+
+ public List<String> getSubjectsToAdd() {
+ return subjectsToAdd;
+ }
+
+ public void setSubjectsToAdd(List<String> subjectsToAdd) {
+ this.subjectsToAdd = subjectsToAdd;
+ }
+
+ public Map<String, String> getSelectableSubjectsMap() {
if (subjectsMap == null) {
subjectsMap = new HashMap<String, String>();
+ if (allSubjects==null)
+ getAllSubjects();
+
+ if (currentSubjects==null)
+ fillSubjectsFromAlertParameters();
- SubjectManagerLocal mgr = LookupUtil.getSubjectManager();
- PageList<Subject> subjectList = mgr.findAllSubjects(new PageControl());
Map<String,String> ret = new HashMap<String, String>();
- for (Subject subject : subjectList) {
- subjectsMap.put(subject.getName(),String.valueOf(subject.getId()));
+ for (Subject subject : allSubjects) {
+ String subjectId = String.valueOf(subject.getId());
+ if (currentSubjects==null || !currentSubjects.contains(subjectId)) {
+ subjectsMap.put(subject.getName(), subjectId);
+ }
}
}
return subjectsMap;
}
- public String submit() {
+ public Map<String, String> getCurrentSubjectsMap() {
+
+ Map<String,String> ret = new HashMap<String, String>();
+ if (currentSubjects==null)
+ return ret;
+
+ for (Subject subject:allSubjects) {
+ if (currentSubjects.contains(String.valueOf(subject.getId())))
+ ret.put(subject.getName(),String.valueOf(subject.getId()) );
+ }
+ return ret;
+
+ }
+
+ public String addSubjects() {
- System.out.println("Selected subjects: ");
+ System.out.println("Selected subjects: ");
String subjects="";
for (String subject : currentSubjects) {
System.out.println(subject);
@@ -117,4 +166,39 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
return "ALERT_NOTIFICATIONS";
}
+
+ public String removeSubjects() {
+ System.out.println("In remove subjects, " + subjectsToRemove);
+
+ String subjects="";
+ List<String> resulting = new ArrayList<String>(currentSubjects);
+ resulting.removeAll(subjectsToRemove);
+
+ for (String subject : resulting) {
+ System.out.println(subject);
+ subjects += subject;
+ subjects += ",";
+ }
+
+ if (subjects.endsWith(","))
+ subjects = subjects.substring(0,subjects.length()-1);
+
+ PropertySimple p = alertParameters.getSimple(SUBJECT_ID);
+ if (p==null) {
+ if (!resulting.isEmpty()) {
+ p = new PropertySimple(SUBJECT_ID,subjects);
+ alertParameters.put(p);
+ }
+ }
+ else
+ p.setStringValue(subjects);
+
+ alertParameters = persistConfiguration(alertParameters);
+
+ currentSubjects = resulting;
+
+ fillSubjectsFromAlertParameters();
+
+ return "ALERT_NOTIFICATIONS";
+ }
}
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
index 92852bf..246b1d9 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
@@ -5,32 +5,48 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
xmlns:a4j="https://richfaces.org/a4j"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<body>
+
<h:panelGrid columns="3">
<h:panelGroup>
<h:outputText>Select the subjects to add:</h:outputText>
<br/>
- <h:selectManyListbox id="mySenderList" value="#{subjectsBean.currentSubjects}">
- <f:selectItems value="#{subjectsBean.subjectsMap}"/>
+ <h:selectManyListbox id="availableSubjectsList"
+ value="#{subjectsBean.currentSubjects}"
+ style="width : 100px"
+ size="3">
+ <f:selectItems value="#{subjectsBean.selectableSubjectsMap}"/>
</h:selectManyListbox>
</h:panelGroup>
<h:panelGroup>
<br/>
<h:commandButton
- id="subjects_submit"
+ id="subjects_submit_add"
value="Add Subjects"
type="submit"
- action="#{subjectsBean.submit}"
+ action="#{subjectsBean.addSubjects}"
+ />
+ <br/>
+ <h:commandButton
+ id="subjects_submit_remove"
+ value="Remove Subjects"
+ type="submit"
+ action="#{subjectsBean.removeSubjects}"
/>
</h:panelGroup>
<h:panelGroup>
- <h:outputText value="${subjectsBean.currentSubjects}"/>
+ <h:selectManyListbox id="selectedSubjectsList"
+ value="#{subjectsBean.subjectsToRemove}"
+ style="width : 100px"
+ size="3">
+ <f:selectItems value="#{subjectsBean.currentSubjectsMap}"/>
+ </h:selectManyListbox>
+
</h:panelGroup>
</h:panelGrid>
</body>
commit 94191d56c1da0ae431b1e17ee0783ee92785884b
Merge: 6ae8295... 3b7d6dc...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Feb 1 15:16:32 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 6ae8295a91812277f3488e87c8cfc4f955b99e51
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Feb 1 15:12:12 2010 -0500
Starting seam refactoring for edit pages
Two main changes with this commit. First, updating the logic for the view.xhtml page action such that
the pre-render action is not invoked on post backs. Secondly, when you click the edit button, you
are taken to edit.xhtml and remain on the same tab whereas previously the navigation logic there
was hard coded. Still need to update the logic for the lower edit button.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index 8e489c7..4ad0606 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -72,6 +72,9 @@ public class ResourceConfigurationEditor {
@RequestParameter("id")
private int resourceId;
+ @RequestParameter
+ private String tab;
+
private boolean readOnly = true;
@Create
@@ -79,6 +82,10 @@ public class ResourceConfigurationEditor {
loadResourceConfigurationDefinition();
loadResourceConfiguration();
initRawConfigDirectories();
+
+ if (tab != null) {
+ setSelectedTab(tab);
+ }
}
private void loadResourceConfigurationDefinition() {
@@ -165,6 +172,22 @@ public class ResourceConfigurationEditor {
return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
}
+ public String getSelectedTab() {
+ if (mode == STRUCTURED_MODE) {
+ return "structuredTab";
+ }
+ return "rawTab";
+ }
+
+ public void setSelectedTab(String tab) {
+ if (tab.equals("structuredTab")) {
+ mode = STRUCTURED_MODE;
+ }
+ else {
+ mode = RAW_MODE;
+ }
+ }
+
public void changeTabs(ValueChangeEvent event) {
if (event.getNewValue().equals("rawTab")) {
// switchToRaw();
@@ -220,4 +243,5 @@ public class ResourceConfigurationEditor {
throw new RuntimeException(e);
}
}
+
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 77f3b3b..b79dba9 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -4,33 +4,22 @@
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.1.xsd">
- <!--<conversation name="updateResourceConfiguration"-->
- <!--parameter-name="resourceId"-->
- <!--parameter-value="#{param.id}"/>-->
-
- <page view-id="/rhq/resource/configuration/view.xhtml" action="#{configurationViewer.initialize}">
+ <page view-id="/rhq/resource/configuration/view.xhtml">
+ <action execute="#{configurationViewer.initialize}" on-postback="false"/>
<navigation from-action="#{ConfigHelperUIBean.accessMap}">
- <!--<render view-id="/rhq/resource/configuration/view-map.xhtml"/>-->
<redirect view-id="/rhq/resource/configuration/view-map.xhtml">
<param name="id" value="#{ResourceUIBean.id}"/>
<param name="listName" value="#{param.listName}"/>
<param name="listIndex" value="#{param.listIndex}"/>
</redirect>
- <!---->
- <!--<rule if-outcome="process">-->
- <!--<redirect view-id="/rhq/resource/configuration/view-map.xhtml"/>-->
- <!--</rule>-->
</navigation>
</page>
<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
- <!--<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configuration}">-->
- <!--<navigation from-action="#{ConfigHelperUIBean.accessMap}" evaluate="#{configurationViewer.initialize}"/>-->
- <!--</page>-->
+ <page view-id="/rhq/resource/configuration/edit.xhtml">
+ <action execute="#{configurationEditor.initialize}" on-postback="false"/>
+ <begin-conversation join="true"/>
+ </page>
- <!--<navigation-case>-->
- <!--<from-action>#{ConfigHelperUIBean.accessMap}</from-action>-->
- <!--<to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>-->
- <!--</navigation-case>-->
</pages>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
index f8e7bba..ba713eb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit.xhtml
@@ -195,7 +195,7 @@ THIS TEXT WILL BE REMOVED.
<c:when test="${ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
<rich:tabPanel id="configTabPanel"
- selectedTab="#{ExistingResourceConfigurationUIBean.selectedTab}"
+ selectedTab="#{configurationEditor.selectedTab}"
switchType="ajax"
valueChangeListener="#{ExistingResourceConfigurationUIBean.changeTabs}">
<rich:tab id="structuredTab"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index 372f06f..59645e9 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -48,10 +48,18 @@ THIS TEXT WILL BE REMOVED.
<h:panelGrid columns="2" style="width:100%">
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
<h:panelGroup style="text-align:right">
+
+ <s:button id="upperEditButton" value="Edit" view="edit.xhtml" styleClass="buttonmed">
+ <f:param name="id" value="#{ResourceUIBean.id}"/>
+ <f:param name="tab" value="#{configurationViewer.selectedTab}"/>
+ </s:button>
+
+ <ui:remove>
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
+ </ui:remove>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
@@ -161,11 +169,15 @@ THIS TEXT WILL BE REMOVED.
</c:when>
<c:when test="${configurationViewer.structuredAndRawSupported}">
- <rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
+ <rich:tabPanel id="resourceConfigurationTabPanel"
+ switchType="ajax"
+ valueChangeListener="#{configurationViewer.changeTabs}">
<rich:tab id="structuredTab"
label="Basic Mode"
onlabelclick="cursor_wait();"
- oncomplete="cursor_clear();">
+ oncomplete="cursor_clear();"
+ limitToList="true"
+ reRender="upperEditButton,fileUpload,upperCommitPanel,lowerCommitPanel">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -186,11 +198,12 @@ THIS TEXT WILL BE REMOVED.
</h:panelGroup>
</h:panelGrid>
</rich:tab>
-
<rich:tab id="rawTab"
label="Advanced Mode"
onlabelclick="cursor_wait();"
- oncomplete="cursor_clear();">
+ oncomplete="cursor_clear();"
+ limitToList="true"
+ reRender="upperEditButton,fileUpload,upperCommitPanel,lowerCommitPanel">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
commit 8d13b5756048cf29672ed6fb717cf0b4539dd60a
Author: Adam Young <ayoung(a)redhat.com>
Date: Mon Feb 1 10:32:01 2010 -0500
Interim checkin of reporting meesages. This one is fairly invasive, in that it redefines a couple core exceptions.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
index aed3f14..550d4a2 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/PluginContainerException.java
@@ -1,27 +1,32 @@
- /*
- * 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, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
package org.rhq.core.clientapi.agent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
/**
* This generic exception thrown by the plugin container is part of its client API; thus this exception is available to
* both the plugin container as well as its remote clients.
@@ -35,6 +40,15 @@ package org.rhq.core.clientapi.agent;
public class PluginContainerException extends Exception {
private static final long serialVersionUID = 1L;
+ private final List<String> messages;
+
+ public PluginContainerException(List<String> messages) {
+ super();
+ List<String> msgs = new ArrayList<String>();
+ Collections.copy(msgs, messages);
+ this.messages = msgs;
+ }
+
/**
* Because this exception is part of the plugin container's client API and thus is to be available on remote clients
* as well, make sure the <code>cause</code> throwable you pass to this constructor is also available to remote
@@ -45,6 +59,7 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(Throwable cause) {
super(cause);
+ messages = Collections.emptyList();
}
/**
@@ -57,12 +72,14 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(String message, Throwable cause) {
super(message, cause);
+ messages = Collections.emptyList();
}
/**
* @see Throwable#Throwable()
*/
public PluginContainerException() {
+ messages = Collections.emptyList();
}
/**
@@ -70,5 +87,10 @@ public class PluginContainerException extends Exception {
*/
public PluginContainerException(String message) {
super(message);
+ messages = Collections.emptyList();
+ }
+
+ public Iterator<String> messageIterator() {
+ return messages.iterator();
}
}
\ No newline at end of file
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java
new file mode 100644
index 0000000..73d8f9f
--- /dev/null
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/configuration/ConfigurationValidationException.java
@@ -0,0 +1,24 @@
+package org.rhq.core.clientapi.agent.configuration;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+public class ConfigurationValidationException extends RuntimeException implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ final List<String> validationMessages;
+
+ public ConfigurationValidationException(List<String> validationMessages) {
+ super();
+ this.validationMessages = new ArrayList<String>(validationMessages);
+ }
+
+ public Iterator<String> messageIterator() {
+ return validationMessages.iterator();
+ }
+}
diff --git a/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java b/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java
new file mode 100644
index 0000000..1ded750
--- /dev/null
+++ b/modules/core/gui/src/main/java/org/rhq/core/gui/converter/TemplateEngineConverter.java
@@ -0,0 +1,29 @@
+package org.rhq.core.gui.converter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import org.rhq.core.template.TemplateEngine;
+
+public class TemplateEngineConverter implements Converter {
+
+ private final TemplateEngine templateEngine;
+
+ public TemplateEngineConverter(TemplateEngine templateEngine) {
+ this.templateEngine = templateEngine;
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ if (null == value){
+ return "";
+ }
+ return templateEngine.replaceTokens(value);
+ }
+
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ if (value == null)return "";
+ return templateEngine.replaceTokens(value.toString());
+ }
+
+}
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 103edc8..c07b999 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
@@ -27,11 +27,14 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.Property;
import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ContainerService;
import org.rhq.core.pc.PluginContainer;
@@ -45,8 +48,11 @@ import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ResourceConfigurationFacet;
import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.template.TemplateEngine;
+import org.rhq.core.util.exception.WrappedRemotingException;
+import java.util.ArrayList;
import java.util.LinkedList;
+import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -268,39 +274,6 @@ public class ConfigurationManager extends AgentService implements ContainerServi
+ "]: " + msg;
}
- // public Configuration loadResourceConfiguration(int resourceId) throws PluginContainerException {
- // ResourceType resourceType = getResourceType(resourceId);
- // ConfigurationFacet configComponent = getConfigurationFacet(resourceId, FacetLockType.READ);
- // try {
- // Configuration configuration = configComponent.loadResourceConfiguration();
- // if (configuration == null) {
- // throw new PluginContainerException("Plugin Error: Resource Component for [" + resourceType.getName()
- // + "] Resource with id [" + resourceId + "] returned a null Configuration.");
- // }
- //
- // // If the plugin didn't already set the notes field, set it to something useful.
- // if (configuration.getNotes() == null) {
- // configuration.setNotes("Resource config for " + resourceType.getName() + " Resource w/ id " + resourceId);
- // }
- //
- // ConfigurationDefinition configurationDefinition = resourceType.getResourceConfigurationDefinition();
- //
- // // Normalize and validate the config.
- // ConfigurationUtility.normalizeConfiguration(configuration, configurationDefinition);
- // List<String> errorMessages = ConfigurationUtility.validateConfiguration(configuration,
- // configurationDefinition);
- // for (String errorMessage : errorMessages) {
- // log.warn("Plugin Error: Invalid " + resourceType.getName() + " Resource configuration returned by "
- // + resourceType.getPlugin() + " plugin - " + errorMessage);
- // }
- //
- // return configuration;
- // } catch (Throwable t) {
- // //noinspection ThrowableInstanceNeverThrown
- // throw new PluginContainerException("Cannot load Resource configuration for [" + resourceId + "]",
- // new WrappedRemotingException(t));
- // }
- // }
/**
* Returns a thread pool that this object will use when asychronously executing configuration operations on a
@@ -374,25 +347,21 @@ public class ConfigurationManager extends AgentService implements ContainerServi
if (isStructured) {
return;
} else {
- StringBuilder errorMessage = null;
-
+ ArrayList<String> errors = new ArrayList<String>();
try{
for (RawConfiguration rawConfiguration : configuration.getRawConfigurations()) {
try {
facet.validateRawConfiguration(rawConfiguration);
} catch (IllegalArgumentException e) {
- if (null == errorMessage){
- errorMessage = new StringBuilder();
- }
- errorMessage.append("file " + rawConfiguration.getPath() +" failed validation with " + e.getMessage()+"." );
+ errors.add(rawConfiguration.getPath() +" :" + e.getMessage());
}
}
}catch(Throwable t){
- errorMessage = new StringBuilder();
- errorMessage.append("configuation validation failed with" + t.getMessage()+".");
+ errors.clear();
+ errors.add("configuation validation failed with" + t.getMessage()+".");
}
- if (null != errorMessage){
- throw new PluginContainerException(errorMessage.toString());
+ if (!errors.isEmpty()){
+ throw new PluginContainerException(new ConfigurationValidationException(errors));
}
}
}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 150f055..feebd98 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -24,6 +24,8 @@ import org.apache.commons.logging.LogFactory;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Out;
import org.jetbrains.annotations.Nullable;
+
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.Configuration;
@@ -41,6 +43,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
+import javax.ejb.EJBException;
import javax.faces.application.FacesMessage;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
@@ -88,8 +91,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
public void begin() {
if (isRawSupported() || isStructuredAndRawSupported()) {
initConfigDirectories();
- }
- else {
+ } else {
rawConfigDirectories = Collections.EMPTY_LIST;
}
}
@@ -132,8 +134,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
if (event.getNewValue().equals("rawTab")) {
switchToRaw();
mode = RAW_MODE;
- }
- else if (event.getNewValue().equals("structuredTab")) {
+ } else if (event.getNewValue().equals("structuredTab")) {
switchToStructured();
mode = STRUCTURED_MODE;
}
@@ -210,33 +211,47 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
ConfigurationMaskingUtility.unmaskConfiguration(getConfiguration(), getConfigurationDefinition());
int resourceId = EnterpriseFacesContextUtility.getResource().getId();
- AbstractResourceConfigurationUpdate updateRequest =
- this.configurationManager.updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(),
- resourceId, getMergedConfiguration(), fromStructured);
- if (updateRequest != null) {
- switch (updateRequest.getStatus()) {
- case SUCCESS:
- case INPROGRESS:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
- + updateRequest.getId() + " has been sent to the Agent.");
+ try {
+ AbstractResourceConfigurationUpdate updateRequest = this.configurationManager
+ .updateStructuredOrRawConfiguration(EnterpriseFacesContextUtility.getSubject(), resourceId,
+ getMergedConfiguration(), fromStructured);
+ if (updateRequest != null) {
+ switch (updateRequest.getStatus()) {
+ case SUCCESS:
+ case INPROGRESS:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_INFO, "Configuration update request with id "
+ + updateRequest.getId() + " has been sent to the Agent.");
+ clearConfiguration();
+ return SUCCESS_OUTCOME;
+ case FAILURE:
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
+ + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
+ return FAILURE_OUTCOME;
+ case UNSENT: {
+ for (int i = 0; i < 3; ++i) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR,
+ "Configuration update was not valid", "" + i);
+ }
+ return FAILURE_OUTCOME;
+ }
+ }
+ } else {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN,
+ "No changes were made to the configuration, so " + "no update request has been sent to the Agent.");
clearConfiguration();
return SUCCESS_OUTCOME;
- case FAILURE:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update request with id "
- + updateRequest.getId() + " failed.", updateRequest.getErrorMessage());
- return FAILURE_OUTCOME;
- case UNSENT:
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "Configuration update was not valid"
- , updateRequest.getErrorMessage());
- return FAILURE_OUTCOME;
- }
- } else {
- FacesContextUtility.addMessage(FacesMessage.SEVERITY_WARN, "No changes were made to the configuration, so "
- + "no update request has been sent to the Agent.");
- clearConfiguration();
- return SUCCESS_OUTCOME;
+ }
+ return null;
+ } catch (EJBException e) {
+ if (e.getCause() instanceof ConfigurationValidationException) {
+ ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
+
+ for (Iterator<String> i = exception.messageIterator(); i.hasNext();) {
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, "", i.next());
+ }
+ }
+ return FAILURE_OUTCOME;
}
- return null;
}
public String finishAddMap() {
@@ -317,8 +332,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
RawConfigUIBean rawUIBean = findRawConfigUIBeanByPath(editedRaw.getPath());
rawUIBean.setModified(false);
getModified().remove(editedRaw.getPath());
- }
- else {
+ } else {
++numberOfModifiedFiles;
}
return null;
@@ -397,8 +411,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
public void setSelectedTab(String tab) {
if (tab.equals("structuredTab")) {
mode = STRUCTURED_MODE;
- }
- else {
+ } else {
mode = RAW_MODE;
}
}
@@ -466,7 +479,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
}
public boolean isStructuredAndRawSupported() {
- return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
+ return getConfigurationDefinition().getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
}
public boolean isFileUploadAvailable() {
@@ -541,8 +554,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
FacesContextUtility.getFacesContext().responseComplete();
return null;
- }
- catch (IOException e) {
+ } catch (IOException e) {
log.error("Failed to complete download request for " + getCurrentPath(), e);
throw new RuntimeException(e);
}
@@ -562,16 +574,14 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
UploadItem fileItem = fileUploader.getFileItem();
if (fileItem.isTempFile()) {
setCurrentContents(FileUtils.readFileToString(fileItem.getFile()));
- }
- else {
+ } else {
setCurrentContents(new String(fileItem.getData()));
}
fileUploader.clear();
}
- return null;
- }
- catch (IOException e) {
+ return null;
+ } catch (IOException e) {
throw new RuntimeException(e);
}
}
@@ -607,7 +617,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
String selectedPath;
private TreeMap<String, RawConfiguration> raws;
-
+
TreeMap<String, RawConfiguration> modified = new TreeMap<String, RawConfiguration>();
RawConfiguration current = null;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index bdeffb8..4eccbff 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -51,6 +51,7 @@ import org.quartz.Trigger;
import org.rhq.core.clientapi.agent.PluginContainerException;
import org.rhq.core.clientapi.agent.configuration.ConfigurationAgentService;
import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
@@ -978,35 +979,41 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
public ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
- Configuration newConfiguration, boolean fromStructured)
- throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException {
+ Configuration newConfiguration, boolean fromStructured) throws ResourceNotFoundException,
+ ConfigurationUpdateStillInProgressException,ConfigurationValidationException {
Configuration configToUpdate = newConfiguration;
if (isStructuredAndRawSupported(resourceId)) {
- configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration,
- fromStructured);
- }
-
- if (isRawSupported(resourceId)){
- try{
- validateResourceConfiguration(subject, resourceId, newConfiguration,false);
- } catch(PluginContainerException e){
- ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null, newConfiguration, subject.getName());
- response.setErrorMessage(e.getMessage());
- response.setStatus(ConfigurationUpdateStatus.UNSENT);
- return response;
- }
- }
-
- ResourceConfigurationUpdate newUpdate =
- configurationManager.persistNewResourceConfigurationUpdateHistory(subject, resourceId, configToUpdate,
- ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
+ configToUpdate = translateResourceConfiguration(subject, resourceId, newConfiguration, fromStructured);
+ }
+
+ if (isRawSupported(resourceId)) {
+ try {
+ validateResourceConfiguration(subject, resourceId, newConfiguration, false);
+ } catch (PluginContainerException e) {
+ if (e.getCause() instanceof ConfigurationValidationException) {
+ ConfigurationValidationException exception = (ConfigurationValidationException) e.getCause();
+ throw exception;
+ }
+
+ ResourceConfigurationUpdate response = new ResourceConfigurationUpdate(null, newConfiguration, subject
+ .getName());
+ response.setErrorMessage(e.getMessage());
+ response.setStatus(ConfigurationUpdateStatus.UNSENT);
+ return response;
+ }
+ }
+
+ ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(
+ subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate, fromStructured);
return newUpdate;
}
- private void validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,boolean isStructured) throws PluginContainerException {
- Resource resource = entityManager.find(Resource.class, resourceId);
+
+ private void validateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
+ boolean isStructured) throws PluginContainerException {
+ Resource resource = entityManager.find(Resource.class, resourceId);
if (resource == null) {
throw new NoResultException("Cannot get live configuration for unknown resource [" + resourceId + "]");
}
@@ -1024,10 +1031,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
Resource resource = entityManager.find(Resource.class, resourceId);
ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
- return (ConfigurationFormat.STRUCTURED_AND_RAW == configDef.getConfigurationFormat() || (ConfigurationFormat.RAW == configDef.getConfigurationFormat()));
+ return (ConfigurationFormat.STRUCTURED_AND_RAW == configDef.getConfigurationFormat() || (ConfigurationFormat.RAW == configDef
+ .getConfigurationFormat()));
}
-
private boolean isStructuredAndRawSupported(int resourceId) {
Resource resource = entityManager.find(Resource.class, resourceId);
ConfigurationDefinition configDef = resource.getResourceType().getResourceConfigurationDefinition();
@@ -1041,10 +1048,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
throws ResourceNotFoundException {
if (isStructuredAndRawSupported(resourceId)) {
- throw new ConfigurationUpdateNotSupportedException("Cannot update a resource configuration that " +
- "supports both structured and raw configuration using this method because there is insufficient " +
- "information. You should instead call updateStructuredOrRawConfiguration() which requires you " +
- "whether the structured or raw was updated.");
+ throw new ConfigurationUpdateNotSupportedException("Cannot update a resource configuration that "
+ + "supports both structured and raw configuration using this method because there is insufficient "
+ + "information. You should instead call updateStructuredOrRawConfiguration() which requires you "
+ + "whether the structured or raw was updated.");
}
// must do this in a separate transaction so it is committed prior to sending the agent request
@@ -1101,8 +1108,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (isStructuredAndRawSupported(resourceId)) {
updateStructuredOrRawConfiguration(subject, resourceId, configuration, false);
- }
- else {
+ } else {
updateResourceConfiguration(subject, resourceId, configuration);
}
}
@@ -1934,8 +1940,8 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
boolean fromStructured) {
if (!isStructuredAndRawSupported(resourceId)) {
- throw new TranslationNotSupportedException("The translation operation is only supported for " +
- "configurations that support both structured and raw.");
+ throw new TranslationNotSupportedException("The translation operation is only supported for "
+ + "configurations that support both structured and raw.");
}
Resource resource = entityManager.find(Resource.class, resourceId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index f3e7d8b..fd59ca9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -20,6 +20,8 @@ package org.rhq.enterprise.server.configuration;
import org.jetbrains.annotations.Nullable;
import org.quartz.SchedulerException;
+
+import org.rhq.core.clientapi.agent.configuration.ConfigurationValidationException;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
@@ -473,7 +475,7 @@ public interface ConfigurationManagerLocal {
ResourceConfigurationUpdate updateStructuredOrRawConfiguration(Subject subject, int resourceId,
Configuration newConfiguration, boolean fromStructured)
- throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException;
+ throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException,ConfigurationValidationException;
Configuration getResourceConfiguration(Subject subject, int resourceId);
commit c867b297caf2044dd3b7df0f53d3a7d1eb9f86b5
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Feb 1 08:33:53 2010 -0500
Initial refactoring to replace usage of ExistingResourceConfigurationViewUIBean with configurationViewer.
ExistingResourceConfigurationViewUIBean was written as a JSF backing bean. configurationViewer
is a seam component instance of the class ConfigurationEditor. It is a port of JSF backing that
leverages seam capabilities like bijection and pre-render actions.
As for the bijection, the configuration and configuration definition are now out-jected into
the context under the names of resourceConfiguration and resourceConfigurationDefinition,
making them available to view.xhtml
Deleting xhtml files that are no longer used. Changing the logging level of a logging statement
in ResourceTreeModelUIBean to debug to reduce noise in the logs.
Changing the page flow behavior when viewing a structured configuration with complex properties
and then clicking on the view button to view a list of maps property. Previously, the request
was forwarded on the server side and the view rendered is view-map.xhtml. Since
configurationViewer has page scope, we lose state when view-map.xhtml is rendered. Now a
client-side redirect to view-map.xhtml is performed with configurationViewer.initialize()
being invoked in a pre-render action which allows for the configuration and configuration
definition to be properly initialized.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
index 150f055..a996407 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ExistingResourceConfigurationUIBean.java
@@ -38,14 +38,12 @@ import org.rhq.enterprise.gui.configuration.AbstractConfigurationUIBean;
import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
-import org.richfaces.event.UploadEvent;
import org.richfaces.model.UploadItem;
import javax.faces.application.FacesMessage;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
@@ -69,7 +67,7 @@ public class ExistingResourceConfigurationUIBean extends AbstractConfigurationUI
private boolean mode = STRUCTURED_MODE;
- @Out
+// @Out
private Collection<RawConfigDirectory> rawConfigDirectories;
@Out
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
index 7771834..260921d 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/RawConfigUIBean.java
@@ -72,6 +72,15 @@ public class RawConfigUIBean {
panelMenuItem.setIcon(getIcon());
}
+ public String getContents() {
+ return rawConfiguration.getContents();
+ }
+
+ public void setContents(String contents) {
+ rawConfiguration.setContents(contents);
+ }
+
+ /** @return The full path name of the raw config file */
public String getPath() {
return rawConfiguration.getPath();
}
@@ -80,6 +89,10 @@ public class RawConfigUIBean {
return rawConfiguration.getPath().replace('/', NamingContainer.SEPARATOR_CHAR);
}
+ /** @return The name of the raw config file excluding its path */
+ // Note: In the mock-up an asterisk is prepended to the file name in the menu to indicate that it has modifications.
+ // We may want to modify this method to include logic for that as the UI evolves. If so, it might also be
+ // good to change the method name to something a bit more descriptive like getFileNameLabel().
public String getFileName() {
File file = new File(rawConfiguration.getPath());
return file.getName();
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
new file mode 100644
index 0000000..f717637
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationComponent.java
@@ -0,0 +1,80 @@
+/*
+ * 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.gui.configuration.resource;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+//@Name("resourceConfiguration")
+//@AutoCreate
+public class ResourceConfigurationComponent {
+
+// private Configuration originalResource
+
+
+// @RequestParameter("id")
+ private int resourceId;
+
+ // @In
+ private ConfigurationDefinition resourceConfigurationDefinition;
+
+// @Create
+ public void loadResourceConfiguration() {
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ AbstractResourceConfigurationUpdate configurationUpdate =
+ configurationManager.getLatestResourceConfigurationUpdate(subject, resourceId);
+ Configuration configuration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+
+ if (configuration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration, resourceConfigurationDefinition);
+ }
+ }
+
+
+
+// @Unwrap
+ public Configuration lookupResourceConfiguration() {
+ Subject subject = EnterpriseFacesContextUtility.getSubject();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ AbstractResourceConfigurationUpdate configurationUpdate =
+ configurationManager.getLatestResourceConfigurationUpdate(subject, resourceId);
+ Configuration configuration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+
+ if (configuration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(configuration, resourceConfigurationDefinition);
+ }
+
+ return configuration;
+ }
+
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationDefinitionComponent.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationDefinitionComponent.java
new file mode 100644
index 0000000..d9e4073
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationDefinitionComponent.java
@@ -0,0 +1,48 @@
+/*
+ * 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.gui.configuration.resource;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+//@Name("resourceConfigurationDefinition")
+//(a)Scope(ScopeType.CONVERSATION)
+public class ResourceConfigurationDefinitionComponent {
+
+// @Unwrap
+ public ConfigurationDefinition lookupResourceConfigurationDefinition() {
+ int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ ConfigurationDefinition configurationDefinition =
+ configurationManager.getResourceConfigurationDefinitionForResourceType(
+ EnterpriseFacesContextUtility.getSubject(), resourceTypeId);
+
+ return configurationDefinition;
+ }
+
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
new file mode 100644
index 0000000..8e489c7
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -0,0 +1,223 @@
+/*
+ * 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.gui.configuration.resource;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.AbstractResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.RawConfiguration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationFormat;
+import org.rhq.core.gui.configuration.ConfigurationMaskingUtility;
+import org.rhq.core.gui.util.FacesContextUtility;
+import org.rhq.enterprise.gui.legacy.WebUser;
+import org.rhq.enterprise.gui.util.EnterpriseFacesContextUtility;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+import javax.faces.event.ValueChangeEvent;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.*;
+
+@Name("configurationEditor")
+(a)Scope(ScopeType.CONVERSATION)
+@Role(name = "configurationViewer", scope = ScopeType.PAGE)
+public class ResourceConfigurationEditor {
+
+ private static final boolean STRUCTURED_MODE = true;
+ private static final boolean RAW_MODE = false;
+
+ private boolean mode = STRUCTURED_MODE;
+
+ private Configuration originalResourceConfiguration;
+
+ @In("webUser")
+ private WebUser loggedInUser;
+
+ @Out
+ private Configuration resourceConfiguration;
+
+ @Out
+ private ConfigurationDefinition resourceConfigurationDefinition;
+
+ @Out
+ private Collection<RawConfigDirectory> rawConfigDirectories;
+
+ @Out(required = false)
+ private RawConfigUIBean selectedRawUIBean;
+
+ @RequestParameter("id")
+ private int resourceId;
+
+ private boolean readOnly = true;
+
+ @Create
+ public void initialize() {
+ loadResourceConfigurationDefinition();
+ loadResourceConfiguration();
+ initRawConfigDirectories();
+ }
+
+ private void loadResourceConfigurationDefinition() {
+ int resourceTypeId = EnterpriseFacesContextUtility.getResource().getResourceType().getId();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ resourceConfigurationDefinition = configurationManager.getResourceConfigurationDefinitionForResourceType(
+ loggedInUser.getSubject(), resourceTypeId);
+ }
+
+ private void loadResourceConfiguration() {
+ Subject subject = loggedInUser.getSubject();
+
+ ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
+ AbstractResourceConfigurationUpdate configurationUpdate =
+ configurationManager.getLatestResourceConfigurationUpdate(subject, resourceId);
+ resourceConfiguration = (configurationUpdate != null) ? configurationUpdate.getConfiguration() : null;
+
+ if (resourceConfiguration != null) {
+ ConfigurationMaskingUtility.maskConfiguration(resourceConfiguration, resourceConfigurationDefinition);
+ }
+
+ }
+
+ private void initRawConfigDirectories() {
+ if (isRawSupported() || isStructuredAndRawSupported()) {
+ initConfigDirectories();
+ }
+ else {
+ rawConfigDirectories = Collections.EMPTY_LIST;
+ }
+ }
+
+ private void initConfigDirectories() {
+ Map<String, RawConfigDirectory> dirs = new TreeMap<String, RawConfigDirectory>();
+
+ for (RawConfiguration rawConfig : resourceConfiguration.getRawConfigurations()) {
+ String parentDirPath = getParentDir(rawConfig);
+ RawConfigDirectory dir = dirs.get(parentDirPath);
+
+ if (dir == null) {
+ dir = new RawConfigDirectory();
+ dir.setPath(parentDirPath);
+ }
+
+ dir.addRawConfig(rawConfig);
+ dirs.put(parentDirPath, dir);
+ }
+
+ rawConfigDirectories = dirs.values();
+
+ RawConfigDirectory selectedDir = null;
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ selectedDir = dir;
+ break;
+ }
+ selectedRawUIBean = selectedDir.getRawConfigUIBeans().get(0);
+ }
+
+ private String getParentDir(RawConfiguration rawConfig) {
+ File file = new File(rawConfig.getPath());
+ return file.getParentFile().getAbsolutePath();
+ }
+
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ public boolean isRawSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.RAW;
+ }
+
+ public boolean isStructuredSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED;
+ }
+
+ public boolean isStructuredAndRawSupported() {
+ return resourceConfigurationDefinition.getConfigurationFormat() == ConfigurationFormat.STRUCTURED_AND_RAW;
+ }
+
+ public void changeTabs(ValueChangeEvent event) {
+ if (event.getNewValue().equals("rawTab")) {
+// switchToRaw();
+ mode = RAW_MODE;
+ }
+ else if (event.getNewValue().equals("structuredTab")) {
+// switchToStructured();
+ mode = STRUCTURED_MODE;
+ }
+ }
+
+ public void edit() {
+ originalResourceConfiguration = resourceConfiguration.deepCopy(true);
+ }
+
+ public void select(String path) {
+ selectedRawUIBean = findRawConfigUIBeanByPath(path);
+ }
+
+ private RawConfigUIBean findRawConfigUIBeanByPath(String path) {
+ for (RawConfigDirectory dir : rawConfigDirectories) {
+ for (RawConfigUIBean bean : dir.getRawConfigUIBeans()) {
+ if (bean.getPath().equals(path)) {
+ return bean;
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isUpdateInProgress() {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ return configurationMgr.isResourceConfigurationUpdateInProgress(loggedInUser.getSubject(), resourceId);
+ }
+
+ public String download() {
+ try {
+ File file = new File(selectedRawUIBean.getFileName());
+
+ HttpServletResponse response = FacesContextUtility.getResponse();
+ response.setHeader("Content-Disposition", "attachment;filename=" + file.getName());
+ OutputStream ostream = response.getOutputStream();
+ ostream.write(selectedRawUIBean.getContents().getBytes());
+ ostream.flush();
+ ostream.close();
+
+ FacesContextUtility.getFacesContext().responseComplete();
+
+ return null;
+ }
+ catch (IOException e) {
+// log.error("Failed to complete download request for " + getCurrentPath(), e);
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java
index 6253c8d..83adec0 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/navigation/resource/ResourceTreeModelUIBean.java
@@ -196,7 +196,7 @@ public class ResourceTreeModelUIBean {
AutoGroupComposite compositeParent = (AutoGroupComposite) parentNode.getData();
Map<Object, List<Resource>> children = new HashMap<Object, List<Resource>>();
- log.error("composite parent" + compositeParent);
+ log.debug("composite parent" + compositeParent);
if (compositeParent != null) {
for (Resource res : compositeParent.getParentResource().getChildResources()) {
if (compositeParent.getSubcategory() != null) {
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/classes/messages.properties b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/classes/messages.properties
index 13a3a73..9c40578 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/classes/messages.properties
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/classes/messages.properties
@@ -15,6 +15,9 @@ javax.faces.validator.DoubleRangeValidator.MAXIMUM = For property "{1}", the val
javax.faces.validator.DoubleRangeValidator.MINIMUM = For property "{1}", the value must be a floating point number greater than or equal to {0}.
javax.faces.validator.DoubleRangeValidator.NOT_IN_RANGE = For property "{2}", the value must be a floating point number between {0} and {1}.
+
+resource.configuration.definition.null=This resource does not expose a configuration.
+resource.configuration.null=This resource's configuration has not yet been initialized.
youareviewingraw = You are viewing this in files mode.
youareviewingstructured = You are viewing this in structured mode.
editstructured=Change Properties
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 85def73..9ea046a 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
@@ -17,10 +17,10 @@
<redirect/>
</navigation-case>
- <navigation-case>
- <from-action>#{ConfigHelperUIBean.accessMap}</from-action>
- <to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>
- </navigation-case>
+ <!--<navigation-case>-->
+ <!--<from-action>#{ConfigHelperUIBean.accessMap}</from-action>-->
+ <!--<to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>-->
+ <!--</navigation-case>-->
</navigation-rule>
<navigation-rule>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
index 371889b..77f3b3b 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/pages.xml
@@ -4,4 +4,33 @@
xsi:schemaLocation="http://jboss.com/products/seam/pages
http://jboss.com/products/seam/pages-2.1.xsd">
+ <!--<conversation name="updateResourceConfiguration"-->
+ <!--parameter-name="resourceId"-->
+ <!--parameter-value="#{param.id}"/>-->
+
+ <page view-id="/rhq/resource/configuration/view.xhtml" action="#{configurationViewer.initialize}">
+ <navigation from-action="#{ConfigHelperUIBean.accessMap}">
+ <!--<render view-id="/rhq/resource/configuration/view-map.xhtml"/>-->
+ <redirect view-id="/rhq/resource/configuration/view-map.xhtml">
+ <param name="id" value="#{ResourceUIBean.id}"/>
+ <param name="listName" value="#{param.listName}"/>
+ <param name="listIndex" value="#{param.listIndex}"/>
+ </redirect>
+ <!---->
+ <!--<rule if-outcome="process">-->
+ <!--<redirect view-id="/rhq/resource/configuration/view-map.xhtml"/>-->
+ <!--</rule>-->
+ </navigation>
+ </page>
+
+ <page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configurationViewer.initialize}"/>
+
+ <!--<page view-id="/rhq/resource/configuration/view-map.xhtml" action="#{configuration}">-->
+ <!--<navigation from-action="#{ConfigHelperUIBean.accessMap}" evaluate="#{configurationViewer.initialize}"/>-->
+ <!--</page>-->
+
+ <!--<navigation-case>-->
+ <!--<from-action>#{ConfigHelperUIBean.accessMap}</from-action>-->
+ <!--<to-view-id>/rhq/resource/configuration/view-map.xhtml</to-view-id>-->
+ <!--</navigation-case>-->
</pages>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/download.jsp b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/download.jsp
deleted file mode 100644
index d207584..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/download.jsp
+++ /dev/null
@@ -1,11 +0,0 @@
-
-<%@page import="org.rhq.enterprise.gui.configuration.resource.ExistingResourceConfigurationUIBean"%><%
- response.setContentType("text/plain");
- Object o = request.getSession().getValue("ExistingResourceConfigurationUIBean");
- if ( o == null){
- response.getWriter().append("Error message goes here.");
- }else{
- ExistingResourceConfigurationUIBean existingResourceConfigurationUIBean = (ExistingResourceConfigurationUIBean)o;
- response.setHeader("Content-Disposition", "attachment;filename="+existingResourceConfigurationUIBean.getCurrentPath());
- response.getWriter().append(new String(existingResourceConfigurationUIBean.getCurrentContents()));
- }%>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw.xhtml
deleted file mode 100644
index d2b8dac..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/edit-raw.xhtml
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-
-<ui:composition template="/rhq/resource/layout/main.xhtml">
- <ui:param name="pageTitle"
- value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Edit Configuration" />
-
- <ui:param name="selectedTabName" value="Configuration.Current" />
-
- <ui:define name="content">
-
- <script>
-
- window.onbeforeunload = confirmExit;
-
- function confirmExit()
- {
-
- }
-</script>
- <a4j:form id="editResourceConfigurationForm">
-
- <h:outputText value="#{messages.youareviewingraw}" />
- <h:panelGroup rendered="#{ExistingResourceConfigurationUIBean.structuredAndRawSupported}">
- <h:outputText value=" #{messages.switch2}" />
- <h:commandLink action="#{ExistingResourceConfigurationUIBean.switchTostructured}">
- <f:param name="conversationId" value="#{conversation.id}"/>
- <f:param name="id" value="#{ResourceUIBean.id}" />
- <h:outputText value=" #{messages.structured}" />
- </h:commandLink>
- </h:panelGroup>
- <table class="summary-props-table" style="">
- <input type="hidden" name="id"
- value="#{ResourceUIBean.id}" />
- <tr>
- <td bgcolor="#a4b2b9" width="25%" valign="top">
- <h:outputText value="#{messages.files}" />
- <div>______________________________________</div>
-
- <h:panelGroup
- id="changedFiles" layout="vertical">
- <ui:repeat value="#{ExistingResourceConfigurationUIBean.paths}" var="path">
- <div><h:outputText value="*"
- rendered="#{ExistingResourceConfigurationUIBean.isModified(path) }" /> <h:commandLink
- value="#{path}" action="#{ExistingResourceConfigurationUIBean.select(path)}"
- rendered="#{path != ExistingResourceConfigurationUIBean.current.path}">
- <f:param name="currentPath" value="#{path}" />
- </h:commandLink> <h:outputText value="#{path}"
- rendered="#{path == ExistingResourceConfigurationUIBean.current.path}" /></div>
- </ui:repeat>
- </h:panelGroup>
- <div>______________________________________</div>
- <div>* <h:outputText value="#{messages.uncommitted}" /></div>
- <h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
-
- <h:commandButton value="SAVE" action="#{ExistingResourceConfigurationUIBean.updateRawConfiguration}"
- title="Click to Save Changes" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure}" />
-
- <a4j:commandButton
- action="#{ExistingResourceConfigurationUIBean.discard}" value="#{messages.discard}"
- reRender="changedFiles" styleClass="buttonmed"/>
- </h:panelGrid>
- </td>
- <td>
- <div>
- <h:outputText value="#{messages.currentfile}" />
- : <h:outputText
- value="#{ExistingResourceConfigurationUIBean.current.path}" styleClass="outhello" />
- </div>
- <h:outputLink value="edit-raw-full.xhtml" action="navigateToFullScreen">
- <img src="/images/viewfullscreen.png" />
- <h:outputText value=" #{messages.fullscreen}" />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- <f:param name="conversationId" value="#{conversation.id}" />
- </h:outputLink> <h:outputLink value="upload.xhtml" action="navigateToUpload">
- <img src="/images/upload.png" />
- <h:outputText value=" #{messages.upload} " />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- <f:param name="conversationId" value="#{conversation.id}" />
- </h:outputLink> <h:outputLink value="download.jsp">
- <img src="/images/download.png" />
- <h:outputText value=" dammit #{messages.download} " />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- </h:outputLink>
-
- <div><h:inputTextarea cols="80" rows="40"
- value="#{ExistingResourceConfigurationUIBean.currentContents}" /></div>
- </td>
- </tr>
-
-
- </table>
- </a4j:form>
- </ui:define>
-
-</ui:composition>
-
-THIS TEXT WILL BE REMOVED AS WELL.
-
-</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload.xhtml
deleted file mode 100644
index a3736d9..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/upload.xhtml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-<ui:composition template="/rhq/layout/main.xhtml">
-<ui:param name="pageTitle" value="Upload Configuration File"/>
-
-<ui:define name="breadcrumbs"></ui:define>
-
-
-<ui:define name="body">
-
-<rich:panel>
- <f:facet name="header">
- <h:outputText value="Upload Configuration File"/>
- </f:facet>
-
- <h:panelGrid columns="1" width="100%">
- <h:form id="uploadform" enctype="multipart/form-data">
- <rich:fileUpload
- id="upload"
- fileUploadListener="#{ExistingResourceConfigurationUIBean.fileUploadListener}"
- maxFilesQuantity="1"
- noDuplicate="true"
- immediateUpload="true"
- autoclear="false"
- allowFlash="false"
- maxRequestSize="100000"
- >
- <a4j:support event="onuploadcomplete" action="#{ExistingResourceConfigurationUIBean.upload}" />
- </rich:fileUpload>
- </h:form>
- </h:panelGrid>
- <h:outputLink value="edit-raw.xhtml" action="toEditRaw" >
- <h:outputText value="#{messages.uploadcomplete}" />
- <f:param name="id" value="#{ExistingResourceConfigurationUIBean.resourceId}" />
- </h:outputLink>
-</rich:panel>
-
-
-</ui:define>
-
-</ui:composition>
-
-</html>
-
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-map.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-map.xhtml
index 91ff1cb..0c60b71 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-map.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-map.xhtml
@@ -27,8 +27,8 @@ THIS TEXT WILL BE REMOVED.
<input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
- <onc:config configurationDefinition="#{ExistingResourceConfigurationUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationUIBean.configuration}"
+ <onc:config configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
listName="#{param.listName}"
listIndex="#{param.listIndex}"
readOnly="true"
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-full.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-full.xhtml
deleted file mode 100644
index e9e8c1a..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw-full.xhtml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.ajax4jsf.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-<ui:composition template="/rhq/layout/main.xhtml">
-<ui:param name="pageTitle" value="TODO Internationalize this"/>
-
-<ui:define name="breadcrumbs" >
-<h:outputLink value="view-raw.xhtml" action="navigateToUpload" >
- <h:outputText value=" Back " />
- <f:param name="id" value="#{ResourceUIBean.id}" />
-</h:outputLink>
-
-</ui:define>
-
-<ui:define name="body">
-
-<h:form id="editResourceConfigurationForm" >
-<input type="hidden" name="id" value="#{ResourceUIBean.id}" />
-<div>
-<pre><h:outputText value="#{ExistingResourceConfigurationUIBean.currentContents}" /></pre>
-</div>
-</h:form>
-</ui:define>
-
-</ui:composition>
-
-</html>
-
-
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
deleted file mode 100644
index 4823f74..0000000
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view-raw.xhtml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0"?>
-
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich"
- xmlns:onc="http://jboss.org/on/component"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-
-<ui:composition template="/rhq/resource/layout/main.xhtml">
- <ui:param name="pageTitle"
- value="#{ResourceUIBean.resourceType.name} '#{ResourceUIBean.name}' - Edit Configuration" />
-
- <ui:param name="selectedTabName" value="Configuration.Current" />
-
- <ui:define name="content">
-
-<script>
-
- window.onbeforeunload = confirmExit;
-
- function confirmExit()
- {
-
- }
-</script>
-
- <h:outputText value="#{messages.youareviewingraw}" />
- <h:panelGroup rendered="#{ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <h:outputText value=" #{messages.switch2}" />
- <h:outputLink value="view.xhtml">
- <s:conversationId />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- <h:outputText value=" #{messages.structured}" />
- </h:outputLink>
- </h:panelGroup>
-
- <h:form id="viewResourceConfigurationForm">
- <!-- TODO remove the id version -->
- <input type="hidden" name="id" value="#{ResourceUIBean.id}"/>
-
-
- <h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell"
- rendered="#{ExistingResourceConfigurationUIBean.configuration != null and !ExistingResourceConfigurationUIBean.updateInProgress}">
-
- <h:commandButton value="#{messages.editstructured}" action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
- title="Edit this Configuration" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and ExistingResourceConfigurationViewUIBean.structuredSupported and !ExistingResourceConfigurationUIBean.updateInProgress}" />
- <h:commandButton value="#{messages.editraw}" action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
- title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and ExistingResourceConfigurationViewUIBean.rawSupported and !ExistingResourceConfigurationUIBean.updateInProgress}" />
- </h:panelGrid>
-
-
- </h:form>
-
- <table class="summary-props-table" style="">
- <tr>
- <td bgcolor="#a4b2b9" width="25%" valign="top">Files
- <h:panelGroup id="changedFiles" layout="vertical">
- <h:form>
- <input type="hidden" name="id" value="#{ResourceUIBean.id}" />
- <ui:repeat value="#{ExistingResourceConfigurationViewUIBean.paths}" var="path">
- <div>
- <h:commandLink
- action="#{ExistingResourceConfigurationViewUIBean.select(path)}"
- value="#{path}"
- rendered="#{path != ExistingResourceConfigurationViewUIBean.current.path}">
- <f:param name="currentPath" value="#{path}" />
- </h:commandLink>
- <h:outputText value="#{path}" rendered="#{path == ExistingResourceConfigurationViewUIBean.current.path}" />
- </div>
- </ui:repeat>
- </h:form>
- </h:panelGroup>
- <div>______________________________________</div>
- <div>* File contains uncommitted changes.</div>
- </td>
- <td>
- <div>
- Current File: <h:outputText value="#{ExistingResourceConfigurationViewUIBean.current.path}"
- styleClass="outhello" />
- </div>
- <h:outputLink value="view-raw-full.xhtml" action="navigateToUpload" >
- <img src="/images/viewfullscreen.png" />
- <h:outputText value=" Full Screen " />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- </h:outputLink><s:link action="#{ExistingResourceConfigurationViewUIBean.download}">
- <img src="/images/download.png" />
- <h:outputText value=" Download " />
- <f:param name="id" value="#{ResourceUIBean.id}" />
- </s:link>
- <div>
- <pre><h:outputText value="#{ExistingResourceConfigurationViewUIBean.currentContents}" /></pre>
- </div>
- </td>
- </tr>
- </table>
- </ui:define>
-
-</ui:composition>
-
-THIS TEXT WILL BE REMOVED AS WELL.
-
-</html>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
index e40b9f1..372f06f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/configuration/view.xhtml
@@ -38,7 +38,7 @@ THIS TEXT WILL BE REMOVED.
</script>
<h:panelGroup layout="block" styleClass="InfoBlock"
- rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
+ rendered="#{configurationViewer.updateInProgress}">
<b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
</h:panelGroup>
@@ -51,15 +51,15 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
<c:choose>
- <c:when test="${ExistingResourceConfigurationViewUIBean.rawSupported}">
+ <c:when test="${configurationViewer.rawSupported}">
- <rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
+ <rich:tabPanel switchType="ajax">
<rich:tab label="Advanced Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
@@ -85,7 +85,7 @@ THIS TEXT WILL BE REMOVED.
icon="/images/blank.png"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
- action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+ action="#{configurationViewer.select(rawConfigUIBean.path)}"
limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor"/>
</c:forEach>
@@ -102,20 +102,20 @@ THIS TEXT WILL BE REMOVED.
<h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
- <h:commandLink action="#{ExistingResourceConfigurationViewUIBean.download}" value="Download">
+ <h:commandLink action="#{configurationViewer.download}" value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
<a4j:status id="selectedFileHeader"
- startText="Loading #{ExistingResourceConfigurationViewUIBean.current.path} ..."
- stopText="#{ExistingResourceConfigurationUIBean.current.path}"/>
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
- value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ value="#{selectedRawUIBean.contents}"
readonly="true"/>
</rich:panel>
</h:panelGrid>
@@ -126,7 +126,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -134,19 +134,18 @@ THIS TEXT WILL BE REMOVED.
<ui:include src="view-raw-modal.xhtml"/>
</c:when>
- <c:when test="${ExistingResourceConfigurationViewUIBean.structuredSupported}">
- <rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
+ <c:when test="${configurationViewer.structuredSupported}">
+ <rich:tabPanel switchType="ajax">
<rich:tab label="Basic Mode" onlabelclick="cursor_wait();" oncomplete="cursor_clear();">
<h:outputText value=" #{messages.nopermissionedit}"
rendered="#{!ResourceUIBean.permissions.configure}"/>
<onc:config
- configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
- accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
readOnly="true"
- nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
- nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
@@ -154,14 +153,14 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
</rich:tabPanel>
</c:when>
- <c:when test="${ExistingResourceConfigurationViewUIBean.structuredAndRawSupported}">
+ <c:when test="${configurationViewer.structuredAndRawSupported}">
<rich:tabPanel switchType="ajax" valueChangeListener="changeTabs">
<rich:tab id="structuredTab"
label="Basic Mode"
@@ -171,12 +170,11 @@ THIS TEXT WILL BE REMOVED.
rendered="#{!ResourceUIBean.permissions.configure}"/>
<onc:config
- configurationDefinition="#{ExistingResourceConfigurationViewUIBean.configurationDefinition}"
- configuration="#{ExistingResourceConfigurationViewUIBean.configuration}"
- accessMapActionExpression="#{ExistingResourceConfigurationViewUIBean.accessMap}"
+ configurationDefinition="#{resourceConfigurationDefinition}"
+ configuration="#{resourceConfiguration}"
readOnly="true"
- nullConfigurationDefinitionMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationDefinitionMessage}"
- nullConfigurationMessage="#{ExistingResourceConfigurationViewUIBean.nullConfigurationMessage}"
+ nullConfigurationDefinitionMessage="#{msg['resource.configuration.definition.null']}"
+ nullConfigurationMessage="#{msg['resource.configuration.null']}"
prevalidate="true"/>
<h:panelGrid columns="1" style="width:100%" columnClasses="raw-edit-footer">
@@ -184,7 +182,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -215,7 +213,7 @@ THIS TEXT WILL BE REMOVED.
icon="/images/blank.png"
onclick="cursor_wait();"
oncomplete="cursor_clear();"
- action="#{ExistingResourceConfigurationViewUIBean.select(rawConfigUIBean.path)}"
+ action="#{configurationViewer.select(rawConfigUIBean.path)}"
limitToList="true"
reRender="fileContents,selectedFileHeader,modalEditor,fileMenu"/>
</c:forEach>
@@ -232,20 +230,20 @@ THIS TEXT WILL BE REMOVED.
<h:outputLink value="#" onclick="#{rich:component('uploadWindow')}.show()">Upload New</h:outputLink>
- <h:commandLink action="#{ExistingResourceConfigurationViewUIBean.download}" value="Download">
+ <h:commandLink action="#{configurationViewer.download}" value="Download">
<h:graphicImage value="/images/download.png"/>
<f:param name="id" value="#{ResourceUIBean.id}"/>
</h:commandLink>
<a4j:status id="selectedFileHeader"
- startText="Loading #{ExistingResourceConfigurationViewUIBean.current.path} ..."
- stopText="#{ExistingResourceConfigurationViewUIBean.current.path}"/>
+ startText="Loading #{selectedRawUIBean.path} ..."
+ stopText="#{selectedRawUIBean.path}"/>
</h:panelGrid>
<rich:panel style="margin-left:1px; border: none;">
<h:inputTextarea id="fileContents"
style="width:100%"
- value="#{ExistingResourceConfigurationViewUIBean.currentContents}"
+ value="#{selectedRawUIBean.contents}"
readonly="true"/>
</rich:panel>
</h:panelGrid>
@@ -256,7 +254,7 @@ THIS TEXT WILL BE REMOVED.
<h:commandButton value="Edit"
action="#{ExistingResourceConfigurationUIBean.editRawConfiguration}"
title="Advanced Mode Edit of Raw Configuration Files" styleClass="buttonmed"
- rendered="${ResourceUIBean.permissions.configure and !ExistingResourceConfigurationViewUIBean.updateInProgress}"/>
+ rendered="${ResourceUIBean.permissions.configure and !configurationViewer.updateInProgress}"/>
</h:panelGroup>
</h:panelGrid>
</rich:tab>
@@ -267,7 +265,7 @@ THIS TEXT WILL BE REMOVED.
</h:form>
<h:panelGroup layout="block" styleClass="InfoBlock"
- rendered="#{ExistingResourceConfigurationViewUIBean.updateInProgress}">
+ rendered="#{configurationViewer.updateInProgress}">
<b>${msg['note']}</b> ${msg['resource.config.Current.updateInProgress']}
</h:panelGroup>
commit d5977e9bd0708ea9eb173bf5a2ee48c25393bd29
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Jan 29 17:56:26 2010 +0100
Now we also show the selected stuff in the custom UI panel.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
index c47666e..f58a9a3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
@@ -61,7 +61,7 @@ public class CustomContentUIBean {
}
String backingBeanName = alertNotificationManager.getBackingBeanNameForSender(this.senderName);
- CustomAlertSenderBackingBean backingBean = alertNotificationManager.getBackingBeanForSender(this.senderName,
+ CustomAlertSenderBackingBean backingBean = alertNotificationManager.getBackingBeanForSender(this.senderName, // TODO notificationId may be stale after removal of notification
notificationId);
if (backingBeanName != null && backingBean != null) {
@@ -75,7 +75,7 @@ public class CustomContentUIBean {
* dynamically assign the component's name so that the plugin author can define the
* name of bean, but this class is not an "official" seam component.
*/
- private void outjectBean(String name, Object bean) {
+ private void outjectBean(String name, CustomAlertSenderBackingBean bean) {
Context pageContext = Contexts.getPageContext();
pageContext.set(name, bean);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
index f45ef94..08cbe40 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
@@ -431,21 +431,24 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
/**
- * Return the backing bean for the AlertSender with the passed shortName
+ * Return the backing bean for the AlertSender with the passed shortName. If a notificationId is passed,
+ * we try to load the configuration for this notification and pass it to the CustomAlertSenderBackingBean instance
* @param shortName name of a sender
- * @param alertNotificationId
+ * @param alertNotificationId id of the notification we assign this sender + its backing bean to
* @return an initialized BackingBean or null in case of error
*/
public CustomAlertSenderBackingBean getBackingBeanForSender(String shortName, Integer alertNotificationId) {
+
AlertSenderPluginManager pluginmanager = alertManager.getAlertPluginManager();
CustomAlertSenderBackingBean bean = pluginmanager.getBackingBeanForSender(shortName);
if (alertNotificationId!=null) {
AlertNotification notification = entityManager.find(AlertNotification.class, alertNotificationId);
if (notification!=null && bean != null) {
- Configuration config = notification.getConfiguration(); // TODO clone?
- config.getAllProperties().size(); // Eager load
- bean.setAlertParameters(config);
+ Configuration config = notification.getConfiguration();
+ Configuration config2 = config.deepCopy(true);
+
+ bean.setAlertParameters(config2);
}
}
return bean;
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml
index 106738b..c456b3b 100644
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@ -33,13 +33,6 @@
</dependency>
<dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.3.1</version>
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server</artifactId>
<version>${project.version}</version>
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
index ade82b0..d577120 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
@@ -55,12 +55,14 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
String rolesString = alertParameters.getSimpleValue("roleId","");
String[] roles = rolesString.split(",");
if (currentRoles==null)
- currentRoles = new ArrayList();
+ currentRoles = new ArrayList<String>();
for (String r : roles)
currentRoles.add(r);
}
public List<String> getCurrentRoles() {
+ if (currentRoles==null)
+ fillRolesFromAlertParameters();
return currentRoles;
}
@@ -76,6 +78,7 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
PageList<Role> rolesList = mgr.findRoles(new PageControl());
for (Role role : rolesList) {
+ // TODO filter out all resources role
this.rolesMap.put(role.getName(), role.getId().toString());
}
}
@@ -85,8 +88,6 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
public String submit() {
- System.out.println("In Submit");
-
System.out.println("Selected roles: ");
String roles="";
for (String role : currentRoles) {
@@ -109,10 +110,6 @@ public class RolesBackingBean extends CustomAlertSenderBackingBean {
fillRolesFromAlertParameters();
-
-
- // TODO: Customise this generated block
-
return "ALERT_NOTIFICATIONS";
}
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
index 4c47a1a..759b820 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
@@ -9,10 +9,10 @@
xmlns:a4j="https://richfaces.org/a4j"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
- <body>
- <h:panelGrid columns="3">
+<body>
+<h:panelGrid columns="3">
- <h:panelGroup>
+ <h:panelGroup>
<h:outputText value="Select the roles to add:" />
<br/>
@@ -20,17 +20,19 @@
<h:selectManyListbox id="mySenderList" value="#{rolesBean.currentRoles}">
<f:selectItems value="#{rolesBean.rolesMap}"/>
</h:selectManyListbox>
- </h:panelGroup>
- <h:panelGroup>
+ </h:panelGroup>
+
+ <h:panelGroup>
<br />
<h:commandButton id="roles_submit"
- value="Add Roles"
- type="submit"
- action="#{rolesBean.submit}" />
- </h:panelGroup>
- <h:panelGroup>
- <h:outputText value="#{rolesBean.currentRoles}"/>
- </h:panelGroup>
- </h:panelGrid>
- </body>
+ value="Add Roles"
+ type="submit"
+ action="#{rolesBean.submit}" />
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputText value="#{rolesBean.currentRoles}"/>
+ </h:panelGroup>
+</h:panelGrid>
+</body>
</html>
\ No newline at end of file
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index b52c6e3..5af59ca 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -65,6 +65,8 @@ public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
}
public List<String> getCurrentSubjects() {
+ if (currentSubjects==null)
+ fillSubjectsFromAlertParameters();
return currentSubjects;
}
commit caa20c37e0c8bc9a71b82be73e59582988b081cc
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Jan 29 17:07:06 2010 +0100
Get the subject sender to basically work
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml
index 13b3b95..511dac3 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -24,6 +24,7 @@
<properties>
<scm.module.path>modules/enterprise/server/plugins/alert-subject/</scm.module.path>
+ <seam.version>2.1.0.SP1</seam.version>
</properties>
<dependencies>
@@ -34,7 +35,7 @@
<version>${project.version}</version>
<scope>provided</scope> <!-- by ear -->
</dependency>
-
+
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server</artifactId>
@@ -43,6 +44,18 @@
<!-- by JBossAS -->
</dependency>
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-seam</artifactId>
+ <version>${seam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
<!-- This is a fix for the Javac bug requiring annotations to be
available when compiling dependent classes. -->
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
index 1e870ba..b52c6e3 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsBackingBean.java
@@ -18,6 +18,7 @@
*/
package org.rhq.enterprise.server.plugins.alertSubject;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -26,22 +27,42 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.seam.annotations.Create;
+
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.util.LookupUtil;
/**
* Backing Bean for the subjects sender alert sender plugin custom UI
* @author Heiko W. Rupp
*/
-public class SubjectsBackingBean {
+public class SubjectsBackingBean extends CustomAlertSenderBackingBean {
private final Log log = LogFactory.getLog(SubjectsBackingBean.class);
private Map<String, String> subjectsMap;
private List<String> currentSubjects;
+ private static final String SUBJECT_ID = "subjectId";
+
+ @Create
+ public void init() {
+ getSubjectsMap();
+ fillSubjectsFromAlertParameters();
+ }
+
+ private void fillSubjectsFromAlertParameters() {
+ String rolesString = alertParameters.getSimpleValue(SUBJECT_ID,"");
+ String[] subjects = rolesString.split(",");
+ if (currentSubjects==null)
+ currentSubjects = new ArrayList<String>();
+ for (String r : subjects)
+ currentSubjects.add(r);
+ }
public List<String> getCurrentSubjects() {
return currentSubjects;
@@ -61,7 +82,7 @@ public class SubjectsBackingBean {
PageList<Subject> subjectList = mgr.findAllSubjects(new PageControl());
Map<String,String> ret = new HashMap<String, String>();
for (Subject subject : subjectList) {
- subjectsMap.put(subject.getName(),subject.getName());
+ subjectsMap.put(subject.getName(),String.valueOf(subject.getId()));
}
}
return subjectsMap;
@@ -69,7 +90,28 @@ public class SubjectsBackingBean {
}
public String submit() {
- // TODO: Customise this generated block
+
+ System.out.println("Selected subjects: ");
+ String subjects="";
+ for (String subject : currentSubjects) {
+ System.out.println(subject);
+ subjects += subject;
+ subjects += ",";
+ }
+ if (subjects.endsWith(","))
+ subjects = subjects.substring(0,subjects.length()-1);
+
+ PropertySimple p = alertParameters.getSimple(SUBJECT_ID);
+ if (p==null) {
+ p = new PropertySimple(SUBJECT_ID,subjects);
+ alertParameters.put(p);
+ }
+ else
+ p.setStringValue(subjects);
+
+ alertParameters = persistConfiguration(alertParameters);
+
+ fillSubjectsFromAlertParameters();
return "ALERT_NOTIFICATIONS";
}
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
index 156fe56..92852bf 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/resources/subjects.xhtml
@@ -9,21 +9,29 @@
xmlns:a4j="https://richfaces.org/a4j"
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
- <body>
- <rich:panel id="subject_config_panel">
- <f:facet name="header">
- <h:outputText>Select the subjects to add:</h:outputText>
- </f:facet>
- <h:selectManyMenu id="mySenderList" value="#{subjectsBean.currentSubjects}">
- <f:selectItems value="#{subjectsBean.subjectMap}"/>
- </h:selectManyMenu>
- <br/>
- <h:commandButton
- id="subjects_submit"
- value="Add Subjects"
- type="submit"
- action="#{subjectsBean.submit}"
- />
- </rich:panel>
- </body>
+<body>
+<h:panelGrid columns="3">
+ <h:panelGroup>
+ <h:outputText>Select the subjects to add:</h:outputText>
+ <br/>
+ <h:selectManyListbox id="mySenderList" value="#{subjectsBean.currentSubjects}">
+ <f:selectItems value="#{subjectsBean.subjectsMap}"/>
+ </h:selectManyListbox>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <br/>
+ <h:commandButton
+ id="subjects_submit"
+ value="Add Subjects"
+ type="submit"
+ action="#{subjectsBean.submit}"
+ />
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputText value="${subjectsBean.currentSubjects}"/>
+ </h:panelGroup>
+</h:panelGrid>
+</body>
</html>
\ No newline at end of file
commit d081350a41087845649c979a0d42cca2179ed1e1
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Jan 29 15:44:23 2010 +0100
Perist config updates.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
index ae1d674..af5928c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -18,13 +18,8 @@
*/
package org.rhq.enterprise.server.plugin.pc.alert;
-import javax.persistence.EntityManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
+import org.rhq.enterprise.server.configuration.ConfigurationManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -47,11 +42,8 @@ public class CustomAlertSenderBackingBean {
protected Configuration persistConfiguration(Configuration config) {
-// AlertNotificationManagerLocal alNo = LookupUtil.getAlertNotificationManager();
-// alNo.updateConfiguration(config);
-
- EntityManager em = LookupUtil.getEntityManager();
- config = em.merge(config);
+ ConfigurationManagerLocal mgr = LookupUtil.getConfigurationManager();
+ config = mgr.mergeConfiguration(config);
return config;
commit 3c6bf7ff7f517624e538189124265813b70c112b
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Jan 29 15:43:01 2010 +0100
Add a method to just merge changes to a passed Configuration.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index fbae47d..d081931 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -177,9 +177,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
configurationManager.completePluginConfigurationUpdate(update);
}
- /*
+ /*
* this method will not fire off the update asynchronously (like the completeResourceConfigurationUpdate method
- * does); instead, it will block until an update response is retrieved from the agent-side resource
+ * does); instead, it will block until an update response is retrieved from the agent-side resource
*/
public void completePluginConfigurationUpdate(PluginConfigurationUpdate update) {
// use EJB3 reference to ourself so that transaction semantics are correct
@@ -1202,7 +1202,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
update.setStatus(response.getStatus());
update.setErrorMessage(response.getErrorMessage());
- /*
+ /*
* instead of checking for completed group resource configuration updates here, let our caller (the
* ConfigurationServerService) do it so that this transaction completes before the check begins
*/
@@ -1944,4 +1944,10 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
}
+ public Configuration mergeConfiguration(Configuration config) {
+
+ Configuration out = entityManager.merge(config);
+ return out;
+ }
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index f54254c..94168aa 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -96,7 +96,7 @@ public interface ConfigurationManagerLocal {
*/
Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst)
throws Exception;
-
+
Configuration getLiveResourceConfiguration(Subject subject, int resourceId, boolean pingAgentFirst,
boolean fromStructured) throws Exception;
@@ -346,7 +346,7 @@ public interface ConfigurationManagerLocal {
* @param subject the current subject
* @param groupId the id of the compatible group
* @return
- * @throws ConfigurationUpdateInProgressException if config updates, for the group or any member, are in progress,
+ * @throws ConfigurationUpdateInProgressException if config updates, for the group or any member, are in progress,
* @throws Exception if 1) one or more of the group's members are DOWN, or 2) we fail to retrieve one or more member
* live configs from the corresponding Agents
*/
@@ -464,7 +464,7 @@ public interface ConfigurationManagerLocal {
* @param resourceId identifies the resource to be updated
* @param newConfiguration the resource's desired new configuration
*
- * @return the resource configuration update item corresponding to this request. null
+ * @return the resource configuration update item corresponding to this request. null
* if newConfiguration is equal to the existing configuration.
*/
@Nullable
@@ -489,4 +489,5 @@ public interface ConfigurationManagerLocal {
Configuration translateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
boolean fromStructured) throws ResourceNotFoundException, TranslationNotSupportedException;
+ Configuration mergeConfiguration(Configuration config);
}
\ No newline at end of file
commit d59759c5526e93a5f203cc50a85bff80d6b4de68
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Fri Jan 29 15:41:58 2010 +0100
Implement the sending part
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
index 4940923..7992fdd 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesSender.java
@@ -18,14 +18,22 @@
*/
package org.rhq.enterprise.server.plugins.alertRoles;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
+import org.rhq.enterprise.server.util.LookupUtil;
/**
* AlertSender that notifies RHQ roles by gathering the email addresses of the
@@ -41,8 +49,38 @@ public class RolesSender extends AlertSender {
@Override
public SenderResult send(Alert alert) {
- PropertySimple subjectIdProp = alertParameters.getSimple("roleId");
+ SenderResult noRecipients = new SenderResult(ResultState.FAILURE, "No recipient roles defined");
+
+ PropertySimple rolesIdProp = alertParameters.getSimple("roleId");
+ if (rolesIdProp==null)
+ return noRecipients;
+
+ String rolesIds = rolesIdProp.getStringValue();
+ if (rolesIds==null)
+ return noRecipients;
+
+ String[] roles = rolesIds.split(",");
+ if (roles.length==0)
+ return noRecipients;
+
+ List<String> emails = new ArrayList<String>();
+ RoleManagerLocal roleManager = LookupUtil.getRoleManager();
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+
+ for (String r: roles) {
+
+ Role role = roleManager.getRole(overlord,Integer.parseInt(r));
+ Set<Subject> subjects = role.getSubjects();
+ for (Subject subject : subjects) {
+ String email = subject.getEmailAddress();
+ if (email!=null)
+ emails.add(email);
+ else
+ if (log.isDebugEnabled())
+ log.debug("Subject " + subject.getId() + " has no email associated ");
+ }
+ }
- return new SenderResult(ResultState.FAILURE,"Not yet implemented");
+ return new SenderResult(ResultState.DEFERRED_EMAIL,"Sending to roles " + rolesIds,emails);
}
}
diff --git a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
index 3736c12..354db91 100644
--- a/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
+++ b/modules/enterprise/server/plugins/alert-subject/src/main/java/org/rhq/enterprise/server/plugins/alertSubject/SubjectsSender.java
@@ -18,14 +18,20 @@
*/
package org.rhq.enterprise.server.plugins.alertSubject;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
import org.rhq.enterprise.server.plugin.pc.alert.ResultState;
import org.rhq.enterprise.server.plugin.pc.alert.SenderResult;
+import org.rhq.enterprise.server.util.LookupUtil;
/**
* AlertSender that notifies RHQ subjects by gathering the email addresses of the
@@ -41,9 +47,30 @@ public class SubjectsSender extends AlertSender {
@Override
public SenderResult send(Alert alert) {
+ SenderResult noSubjects = new SenderResult(ResultState.FAILURE,"No subjects defined");
PropertySimple subjectIdProp = alertParameters.getSimple("subjectId");
+ if (subjectIdProp==null )
+ return noSubjects;
+
+ String subjectIdString = subjectIdProp.getStringValue();
+ if (subjectIdString==null)
+ return noSubjects;
+
+ String[] subjectIds = subjectIdString.split(",");
+
+ List<String> emails = new ArrayList<String>(subjectIds.length);
+ SubjectManagerLocal subjectMgr = LookupUtil.getSubjectManager();
+ for (String subjectId : subjectIds ) {
+ Subject subject = subjectMgr.getSubjectById(Integer.parseInt(subjectId));
+ String emailAddress = subject.getEmailAddress();
+ if (emailAddress!=null)
+ emails.add(emailAddress);
+ else
+ if (log.isDebugEnabled())
+ log.debug("Subject " + subject.getId() + " has no email associated ");
+ }
- return new SenderResult(ResultState.FAILURE,"Not yet implemented");
+ return new SenderResult(ResultState.DEFERRED_EMAIL,"Sending to subject ids " + subjectIdString , emails);
}
}
commit 3b7d6dc377c6c5e211ce8b868ccd0801f0b57a7a
Author: Adam Young <ayoung(a)redhat.com>
Date: Thu Jan 28 14:20:46 2010 -0500
Catch and exception and return an empty template enginer if SystemInfoFactory throws and exception. Reorder operations in ConfigurationManager to not swallow a null exception.
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
index 2558b44..27a1375 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
@@ -343,10 +343,12 @@ public class SystemInfoFactory {
public static TemplateEngine fetchTemplateEngine() {
+ try{
SystemInfo systemInfo = createSystemInfo();
Map<String, String> tokens = new HashMap<String, String>();
tokens.put(TOKEN_PREFIX+"hostname", systemInfo.getHostname());
+
tokens.put(TOKEN_PREFIX+"os.name", systemInfo.getOperatingSystemName());
tokens.put(TOKEN_PREFIX+"os.version", systemInfo.getOperatingSystemVersion());
tokens.put(TOKEN_PREFIX+"os.type", systemInfo.getOperatingSystemType().toString());
@@ -366,7 +368,10 @@ public class SystemInfoFactory {
tokens.put(key + ".multicast.address", networkAdapter.getMulticastAddresses().get(0).getHostAddress());
}
}
- TemplateEngine templateEngine = new TemplateEngine(tokens);
+ TemplateEngine templateEngine = new TemplateEngine(tokens);
return templateEngine;
+ }catch(Exception e){
+ return new TemplateEngine(new HashMap());
+ }
}
}
\ No newline at end of file
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 77fea1b..103edc8 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
@@ -217,15 +217,14 @@ public class ConfigurationManager extends AgentService implements ContainerServi
prepareConfigForMergeIntoRaws(configuration, rawConfigs);
Queue<RawConfiguration> queue = new LinkedList<RawConfiguration>(rawConfigs);
- TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
+ TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
while (!queue.isEmpty()) {
RawConfiguration originalRaw = queue.poll();
RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
-
- //TODO bypass validation of structured config for template values
- mergedRaw.setContents(templateEngine.replaceTokens(mergedRaw.getContents()));
if (mergedRaw != null) {
+ //TODO bypass validation of structured config for template values
+ mergedRaw.setContents(templateEngine.replaceTokens(mergedRaw.getContents()));
updateRawConfig(configuration, originalRaw, mergedRaw);
}
}
commit f5a0771580f24869dfe96c6b09f8c8a56a933197
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Jan 28 17:50:46 2010 +0100
Prevent NPE when the bean could not be instantiated.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
index f1b6fd7..aa9c6c9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
@@ -247,11 +247,11 @@ public class AlertSenderPluginManager extends ServerPluginManager {
try {
bean = (CustomAlertSenderBackingBean) instantiatePluginClass(env, className);
+ bean.alertParameters = new Configuration(); // Just to be sure
} catch (Exception e) {
log.error("Can't instantiate alert sender backing bean [" + className + "]. Cause: " + e.getMessage());
}
- bean.alertParameters = new Configuration(); // TODO fix me
return bean;
}
commit ad4faa6484ea7695186e603184712be54360d664
Author: Heiko W. Rupp <pilhuhn(a)fedorapeople.org>
Date: Thu Jan 28 17:19:41 2010 +0100
Custom backing beans now extend CustomAlertSenderBackingBean and get the alertParameters injected.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
index d4dfc2c..c47666e 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/CustomContentUIBean.java
@@ -29,6 +29,7 @@ import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.log.Log;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderInfo;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.util.LookupUtil;
@Scope(ScopeType.PAGE)
@@ -40,6 +41,10 @@ public class CustomContentUIBean {
@RequestParameter
private String senderName;
+
+ @RequestParameter
+ private Integer notificationId;
+
private String contentUrl;
public String getContentUrl() {
@@ -56,7 +61,8 @@ public class CustomContentUIBean {
}
String backingBeanName = alertNotificationManager.getBackingBeanNameForSender(this.senderName);
- Object backingBean = alertNotificationManager.getBackingBeanForSender(this.senderName);
+ CustomAlertSenderBackingBean backingBean = alertNotificationManager.getBackingBeanForSender(this.senderName,
+ notificationId);
if (backingBeanName != null && backingBean != null) {
outjectBean(backingBeanName, backingBean);
@@ -65,7 +71,7 @@ public class CustomContentUIBean {
/**
* We are just getting an Object from the plugin manager which acts as our backing bean.
- * This method is used instead of @Out or @Factory because we need to be able to
+ * This method is used instead of @Out or @Factory because we need to be able to
* dynamically assign the component's name so that the plugin author can define the
* name of bean, but this class is not an "official" seam component.
*/
@@ -73,4 +79,4 @@ public class CustomContentUIBean {
Context pageContext = Contexts.getPageContext();
pageContext.set(name, bean);
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
index e9afb57..4f2c3d9 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/alert/NotificationTemplatesUIBean.java
@@ -349,7 +349,8 @@ public class NotificationTemplatesUIBean implements Serializable {
NotificationTemplate templ;
try {
- templ = alertNotificationManager.createNotificationTemplate(newTemplateName,newTemplateDescription,new ArrayList<AlertNotification>());
+ templ = alertNotificationManager.createNotificationTemplate(newTemplateName,newTemplateDescription,new ArrayList<AlertNotification>(),
+ true);
selectedTemplate = templ;
alertNotifications = selectedTemplate.getNotifications();
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
index cd9e56c..2412402 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/alert/notif/listAlertSender.xhtml
@@ -41,19 +41,19 @@
<a4j:support event="onclick"
ignoreDupResponses="true"
requestDelay="25"
- reRender="alertConfig,senderName"
+ reRender="alertConfig,senderName,notificationId"
oncomplete="updateCustomContent();"
onsubmit="showLoadConfig();" />
<a4j:support event="onkeyup"
ignoreDupResponses="true"
requestDelay="150"
- reRender="alertConfig,senderName"
+ reRender="alertConfig,senderName,notificationId"
oncomplete="updateCustomContent();"
onsubmit="showLoadConfig();" />
<a4j:support event="onorderchanged"
ignoreDupResponses="true"
requestDelay="250"
- reRender="senderName" />
+ reRender="senderName,notificationId" />
</rich:orderingList>
</h:form>
@@ -70,7 +70,7 @@
value="Remove Selected"
action="#{alertNotificationsUIBean.removeSelected}"
styleClass="buttonmed"/>
-
+
<br /><br />
<h:outputLink id="addAlertLink" styleClass="buttonmed" value="#">
<h:outputText value="Add New Alert Notification" />
@@ -111,6 +111,9 @@
<h:outputText id="senderName"
style="display: none;"
value="#{alertNotificationsUIBean.activeNotification.senderName}" />
+ <h:outputText id="notificationId"
+ style="display: none;"
+ value="#{alertNotificationsUIBean.activeNotification.id}" />
</h:panelGrid>
</a4j:region>
</rich:panel>
@@ -156,7 +159,7 @@
</h:commandButton>
</h:form>
</rich:panel>
-
+
<rich:panel id="addAlertFromTemplatePanel">
<f:facet name="header">
<h:outputText value="Add Alert Notifications from template"/>
@@ -199,15 +202,18 @@
<h:outputText value="Back to Alert Definitions for Resource '#{ResourceUIBean.name}'"/>
</h:outputLink>
-
-
+
+
<script type="text/javascript">
function updateCustomContent() {
var sender = $('senderName').innerHTML;
+ var notificationId = $('notificationId').innerHTML;
new Ajax.Updater('customContentArea',
'notif/customContent.xhtml',
{ method: 'get',
- parameters: {'senderName': sender, 'ad': #{param.ad}, 'id': #{param.id}}
+ parameters: {'senderName': sender, 'ad': #{param.ad}, 'id': #{param.id},
+ 'notificationId' : notificationId
+ }
});
hideLoadConfig();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
index 8b4f047..f45ef94 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerBean.java
@@ -62,6 +62,7 @@ import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataMan
import org.rhq.enterprise.server.plugin.ServerPluginsLocal;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderInfo;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderPluginManager;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.xmlschema.generated.serverplugin.alert.AlertPluginDescriptorType;
/**
@@ -432,11 +433,22 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
/**
* Return the backing bean for the AlertSender with the passed shortName
* @param shortName name of a sender
+ * @param alertNotificationId
* @return an initialized BackingBean or null in case of error
*/
- public Object getBackingBeanForSender(String shortName) {
+ public CustomAlertSenderBackingBean getBackingBeanForSender(String shortName, Integer alertNotificationId) {
AlertSenderPluginManager pluginmanager = alertManager.getAlertPluginManager();
- return pluginmanager.getBackingBeanForSender(shortName);
+ CustomAlertSenderBackingBean bean = pluginmanager.getBackingBeanForSender(shortName);
+
+ if (alertNotificationId!=null) {
+ AlertNotification notification = entityManager.find(AlertNotification.class, alertNotificationId);
+ if (notification!=null && bean != null) {
+ Configuration config = notification.getConfiguration(); // TODO clone?
+ config.getAllProperties().size(); // Eager load
+ bean.setAlertParameters(config);
+ }
+ }
+ return bean;
}
public String getBackingBeanNameForSender(String shortName) {
@@ -554,11 +566,14 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
* @param name name of this notification template. Must be unique
* @param description description of the template
* @param notifications notifications that make up the template
+ * @param copyNotifications
* @return the newly created template
* @throws IllegalArgumentException when a template with the passed name already exists
*/
@SuppressWarnings("unchecked")
- public NotificationTemplate createNotificationTemplate(String name, String description, List<AlertNotification> notifications) throws IllegalArgumentException {
+ public NotificationTemplate createNotificationTemplate(String name, String description,
+ List<AlertNotification> notifications,
+ boolean copyNotifications) throws IllegalArgumentException {
Query q = entityManager.createNamedQuery(NotificationTemplate.FIND_BY_NAME);
q.setParameter("name",name);
@@ -570,9 +585,14 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
NotificationTemplate templ = new NotificationTemplate(name,description);
entityManager.persist(templ);
for (AlertNotification n : notifications) {
- n.setNotificationTemplate(templ);
- templ.addNotification(n);
- entityManager.persist(n);
+ if (copyNotifications) {
+// AlertNotification alNo = n.copyWithAlertDefintion() TODO implement / fix this
+ }
+ else {
+ n.setNotificationTemplate(templ);
+ templ.addNotification(n);
+ entityManager.persist(n);
+ }
}
return templ;
@@ -689,4 +709,4 @@ public class AlertNotificationManagerBean implements AlertNotificationManagerLoc
def.addAlertNotification(alNo);
}
}
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
index db29337..754bb63 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertNotificationManagerLocal.java
@@ -34,6 +34,7 @@ import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSender;
import org.rhq.enterprise.server.plugin.pc.alert.AlertSenderInfo;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
/**
* @author Joseph Marques
@@ -123,9 +124,10 @@ public interface AlertNotificationManagerLocal {
/**
* Return the backing bean for the AlertSender with the passed shortNama
* @param shortName name of a sender
+ * @param alertNotificationId
* @return an initialized BackingBean or null in case of error
*/
- Object getBackingBeanForSender(String shortName);
+ CustomAlertSenderBackingBean getBackingBeanForSender(String shortName, Integer alertNotificationId);
String getBackingBeanNameForSender(String shortName);
@@ -144,10 +146,12 @@ public interface AlertNotificationManagerLocal {
* @param name name of this notification template. Must be unique
* @param description description of the template
* @param notifications notifications that make up the template
+ * @param copyNotifications
* @return the newly created template
* @throws IllegalArgumentException when a template with the passed name already exists
*/
- NotificationTemplate createNotificationTemplate(String name, String description, List<AlertNotification> notifications) throws IllegalArgumentException;
+ NotificationTemplate createNotificationTemplate(String name, String description,
+ List<AlertNotification> notifications, boolean copyNotifications) throws IllegalArgumentException;
/**
* Get all defined notification templates in the system along with their AlertNotifications
@@ -186,4 +190,4 @@ public interface AlertNotificationManagerLocal {
* @return number of templates deleted
*/
int deleteNotificationTemplates(Subject subject, Integer[] templateIds);
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
index 40aafee..f1b6fd7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/AlertSenderPluginManager.java
@@ -235,7 +235,7 @@ public class AlertSenderPluginManager extends ServerPluginManager {
return senderInfoByName.get(shortName);
}
- public Object getBackingBeanForSender(String shortName) {
+ public CustomAlertSenderBackingBean getBackingBeanForSender(String shortName) {
String className = backingBeanByName.get(shortName);
if (className == null) {
@@ -243,14 +243,16 @@ public class AlertSenderPluginManager extends ServerPluginManager {
}
ServerPluginEnvironment env = pluginEnvByName.get(shortName);
- Object bean = null;
+ CustomAlertSenderBackingBean bean = null;
try {
- bean = instantiatePluginClass(env, className);
+ bean = (CustomAlertSenderBackingBean) instantiatePluginClass(env, className);
} catch (Exception e) {
log.error("Can't instantiate alert sender backing bean [" + className + "]. Cause: " + e.getMessage());
}
+ bean.alertParameters = new Configuration(); // TODO fix me
+
return bean;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
new file mode 100644
index 0000000..ae1d674
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/alert/CustomAlertSenderBackingBean.java
@@ -0,0 +1,59 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.plugin.pc.alert;
+
+import javax.persistence.EntityManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * Abstract super class for custom alert sender backing beans
+ *
+ * @author Heiko W. Rupp
+ */
+public class CustomAlertSenderBackingBean {
+
+ /** Configuration from the per alert definition parameters */
+ protected Configuration alertParameters;
+
+ public Configuration getAlertParameters() {
+ return alertParameters;
+ }
+
+ public void setAlertParameters(Configuration alertParameters) {
+ this.alertParameters = alertParameters;
+ }
+
+ protected Configuration persistConfiguration(Configuration config) {
+
+// AlertNotificationManagerLocal alNo = LookupUtil.getAlertNotificationManager();
+// alNo.updateConfiguration(config);
+
+ EntityManager em = LookupUtil.getEntityManager();
+ config = em.merge(config);
+
+ return config;
+
+ }
+}
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
index 780d4de..ade82b0 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/java/org/rhq/enterprise/server/plugins/alertRoles/RolesBackingBean.java
@@ -19,26 +19,47 @@
package org.rhq.enterprise.server.plugins.alertRoles;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
+import org.jboss.seam.annotations.Create;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertNotificationManagerLocal;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
+import org.rhq.enterprise.server.plugin.pc.alert.CustomAlertSenderBackingBean;
import org.rhq.enterprise.server.util.LookupUtil;
/**
- * // TODO: Document this
+ *
* @author Heiko W. Rupp
*/
-public class RolesBackingBean {
+public class RolesBackingBean extends CustomAlertSenderBackingBean {
private Map<String, String> rolesMap;
private List<String> currentRoles;
+ @Create
+ public void init() {
+ getRolesMap();
+ fillRolesFromAlertParameters();
+ }
+
+ private void fillRolesFromAlertParameters() {
+ String rolesString = alertParameters.getSimpleValue("roleId","");
+ String[] roles = rolesString.split(",");
+ if (currentRoles==null)
+ currentRoles = new ArrayList();
+ for (String r : roles)
+ currentRoles.add(r);
+ }
+
public List<String> getCurrentRoles() {
return currentRoles;
}
@@ -67,9 +88,26 @@ public class RolesBackingBean {
System.out.println("In Submit");
System.out.println("Selected roles: ");
+ String roles="";
for (String role : currentRoles) {
System.out.println(role);
+ roles += role;
+ roles += ",";
+ }
+ if (roles.endsWith(","))
+ roles = roles.substring(0,roles.length()-1);
+
+ PropertySimple p = alertParameters.getSimple("roleId");
+ if (p==null) {
+ p = new PropertySimple("roleId",roles);
+ alertParameters.put(p);
}
+ else
+ p.setStringValue(roles);
+
+ alertParameters = persistConfiguration(alertParameters);
+
+ fillRolesFromAlertParameters();
diff --git a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
index 8650eac..4c47a1a 100644
--- a/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
+++ b/modules/enterprise/server/plugins/alert-roles/src/main/resources/roles.xhtml
@@ -10,18 +10,27 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich">
<body>
- <br />
+ <h:panelGrid columns="3">
+
+ <h:panelGroup>
<h:outputText value="Select the roles to add:" />
<br/>
+
<h:selectManyListbox id="mySenderList" value="#{rolesBean.currentRoles}">
<f:selectItems value="#{rolesBean.rolesMap}"/>
</h:selectManyListbox>
-
+ </h:panelGroup>
+ <h:panelGroup>
<br />
<h:commandButton id="roles_submit"
value="Add Roles"
type="submit"
action="#{rolesBean.submit}" />
+ </h:panelGroup>
+ <h:panelGroup>
+ <h:outputText value="#{rolesBean.currentRoles}"/>
+ </h:panelGroup>
+ </h:panelGrid>
</body>
</html>
\ No newline at end of file
commit fe14f8290fcfda3a67cf539bdc522cf7d1d111c6
Merge: 9d8385a... 1f67b2e...
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 27 22:27:48 2010 -0500
Merge branch 'raw-config' of ssh://git.fedorahosted.org/git/rhq/rhq into raw-config
commit 9d8385acb33603016a03c6e4b5be9b862549fa3d
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 27 22:27:16 2010 -0500
Now templatizes during translation for structured to raw.
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 580da62..77fea1b 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
@@ -217,11 +217,14 @@ public class ConfigurationManager extends AgentService implements ContainerServi
prepareConfigForMergeIntoRaws(configuration, rawConfigs);
Queue<RawConfiguration> queue = new LinkedList<RawConfiguration>(rawConfigs);
-
+ TemplateEngine templateEngine = SystemInfoFactory.fetchTemplateEngine();
+
while (!queue.isEmpty()) {
RawConfiguration originalRaw = queue.poll();
RawConfiguration mergedRaw = facet.mergeRawConfiguration(configuration, originalRaw);
+ //TODO bypass validation of structured config for template values
+ mergedRaw.setContents(templateEngine.replaceTokens(mergedRaw.getContents()));
if (mergedRaw != null) {
updateRawConfig(configuration, originalRaw, mergedRaw);
}
commit b10d6026bba36c90530077dec3f22475c34ac69c
Author: Adam Young <ayoung(a)redhat.com>
Date: Wed Jan 27 21:16:56 2010 -0500
Modified the key for template replacement.
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
index 3a29fff..2558b44 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/SystemInfoFactory.java
@@ -43,6 +43,8 @@ import org.rhq.core.util.exception.ThrowableUtil;
* @author John Mazzitelli
*/
public class SystemInfoFactory {
+ private static final String TOKEN_PREFIX = "rhq.system.";
+
private static final Log LOG = LogFactory.getLog(SystemInfoFactory.class);
private static final String NATIVE_LIBRARY_CLASS_NAME = "org.hyperic.sigar.Sigar";
@@ -344,15 +346,15 @@ public class SystemInfoFactory {
SystemInfo systemInfo = createSystemInfo();
Map<String, String> tokens = new HashMap<String, String>();
- tokens.put("rhq.hostname", systemInfo.getHostname());
- tokens.put("rhq.os.name", systemInfo.getOperatingSystemName());
- tokens.put("rhq.os.version", systemInfo.getOperatingSystemVersion());
- tokens.put("rhq.os.type", systemInfo.getOperatingSystemType().toString());
- tokens.put("rhq.cpu.count", Integer.toString(systemInfo.getNumberOfCpus()));
- tokens.put("rhq.architecture", systemInfo.getSystemArchitecture());
+ tokens.put(TOKEN_PREFIX+"hostname", systemInfo.getHostname());
+ tokens.put(TOKEN_PREFIX+"os.name", systemInfo.getOperatingSystemName());
+ tokens.put(TOKEN_PREFIX+"os.version", systemInfo.getOperatingSystemVersion());
+ tokens.put(TOKEN_PREFIX+"os.type", systemInfo.getOperatingSystemType().toString());
+ tokens.put(TOKEN_PREFIX+"cpu.count", Integer.toString(systemInfo.getNumberOfCpus()));
+ tokens.put(TOKEN_PREFIX+"architecture", systemInfo.getSystemArchitecture());
for (NetworkAdapterInfo networkAdapter : systemInfo.getAllNetworkAdapters()) {
- String key = "rhq.interfaces." + networkAdapter.getName();
+ String key = TOKEN_PREFIX+"interfaces." + networkAdapter.getName();
tokens.put(key + ".mac", networkAdapter.getMacAddressString());
tokens.put(key + ".type", networkAdapter.getType());
tokens.put(key + ".flags", networkAdapter.getAllFlags());
commit 9d3d943964cd409a95aafc42fb3afec6885a1ad5
Merge: 9ef7216... 6ee8a12...
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Tue Jan 26 11:25:25 2010 +0100
Merge branch 'linux-config' of ssh://git.fedorahosted.org/git/rhq/rhq into linux-config
commit 9ef7216b336c70f316a91b7f9a1801ef87ea127d
Merge: 6413b2c... 58a51a0...
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Mon Jan 11 08:51:45 2010 +0100
lens file load from temp
diff --cc modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
index 100736c,a3d1966..2ce95b1
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
@@@ -92,29 -94,29 +93,29 @@@ public class AugeasProxy
* Initializes and loads the Augeas tree.
*
* @throws AugeasTreeException
+ * @throws AugeasException if Augeas could not be initialized.
*/
- public void load() throws AugeasTreeException, AugeasException {
+ public void load() throws AugeasTreeException {
- config.loadFiles();
- augeas = new Augeas(config.getRootPath(), config.getLoadPath(), config.getMode());
-
try {
- for (AugeasModuleConfig module : config.getModules()) {
-
- modules.add(module.getModuletName());
-
- augeas.set("/augeas/load/" + module.getModuletName() + "/lens", module.getLensPath());
-
- int idx = 1;
- for (String incl : module.getConfigFiles()) {
- augeas.set("/augeas/load/" + module.getModuletName() + "/incl[" + (idx++) + "]", incl);
+ config.loadFiles();
+ augeas = new Augeas(config.getRootPath(), config.getLoadPath(), config.getMode());
+
+ for (AugeasModuleConfig module : config.getModules()) {
+
+ modules.add(module.getModuletName());
+ augeas.set("/augeas/load/" + module.getModuletName() + "/lens", module.getLensPath());
+
+ int idx = 1;
+ for (String incl : module.getConfigFiles()) {
+ augeas.set("/augeas/load/" + module.getModuletName() + "/incl[" + (idx++) + "]", incl);
+ }
}
-
- }
- }catch(Exception e){
- log.error("Loading of augeas failed",e);
- throw new AugeasTreeException(e);
+ augeas.load();
+ } catch (NoClassDefFoundError e) {
+ throw new AugeasException("Failed to initialize Augeas. It is probably not installed.", e);
+ } catch (Exception e) {
+ throw new AugeasException(e);
}
- augeas.load();
}
commit 6413b2cef4456bad09b934cdac0d7457738f3b65
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Mon Jan 11 08:37:52 2010 +0100
loading lens from temp file
diff --git a/modules/plugins/apache/src/main/resources/Httpd.aug b/modules/plugins/apache/src/main/resources/Httpd.aug
new file mode 100644
index 0000000..06ba761
--- /dev/null
+++ b/modules/plugins/apache/src/main/resources/Httpd.aug
@@ -0,0 +1,59 @@
+module Httpd =
+ autoload xfm
+
+(* Helpers *)
+
+(* Newlines can be escaped. *)
+let sep = del /([ \t]+(\\\\\n)?)+/ " "
+let eol = del /([ \t]*(\\\\\n)?)*\n/ "\n"
+
+let ws = /[ \t]*/
+let alnum = /[a-zA-Z0-9_]+/
+(* the last character in the non-quoted word must not be a backslash. I guess this is not completely semantically
+ correct but at the same time, apache discourages to use backslashes for anything else than
+ line breaking so we should be safe here. This restriction is in place to support
+ escaped new lines in the sep and eol rules. *)
+let word = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n]*[^'" \t\n\\]/
+let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n>]+/
+let wskey (k:regexp) = del ws "" . key k
+let params (param:regexp) = [ sep . label "param" . store param ]*
+let sec (name:string) (body:lens) =
+ [ wskey ("<" . name) . params secarg . Util.del_str ">" . eol .
+ body . del ws "" . Util.del_str("</" . name . ">") . eol ]
+
+(* Definitions *)
+let comment = [ del /([ \t]*(#.*)*)\n/ "#\n" ]
+let directive = [ wskey alnum . params word . eol ]
+
+let section (name:string) = sec name (directive|comment)*
+
+let sections = section "IfModule"
+ | section "Directory"
+ | section "DirectoryMatch"
+ | section "Files"
+ | section "FilesMatch"
+ | section "Location"
+ | section "LocationMatch"
+ | section "AuthnProviderAlias"
+ | section "IfDefine"
+ | section "IfVersion"
+ | section "Limit"
+ | section "LimitExcept"
+ | section "Proxy"
+ | section "ProxyMatch"
+
+let virtualHost = sec "VirtualHost" (directive|comment|sections)*
+
+(* What we want ot say is *)
+(* let rec body = (directive|comment)* | ifModule body | directory body | ... *)
+(* but we can't typecheck that *)
+
+(* FIXME: *)
+(* - Nesting of sections *)
+let lns = (directive | comment | sections | virtualHost)*
+
+let filter =
+ incl "/etc/httpd/conf/httpd.conf" .
+ Util.stdexcl
+
+let xfm = transform lns filter
diff --git a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
index aaefeb0..659c4b6 100644
--- a/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/apache/src/main/resources/META-INF/rhq-plugin.xml
@@ -270,8 +270,6 @@
displayName="Httpd config file" required="true" readOnly="true"
default="/etc/httpd/conf/httpd.conf"
description="Location of the Apache main configuration file."/>
- <c:simple-property name="augeasLoadPath" required="true" readOnly="true"
- default="/usr/share/augeas/lenses"/>
</c:group>
diff --git a/modules/plugins/apache/src/main/resources/httpd.aug b/modules/plugins/apache/src/main/resources/httpd.aug
deleted file mode 100644
index 06ba761..0000000
--- a/modules/plugins/apache/src/main/resources/httpd.aug
+++ /dev/null
@@ -1,59 +0,0 @@
-module Httpd =
- autoload xfm
-
-(* Helpers *)
-
-(* Newlines can be escaped. *)
-let sep = del /([ \t]+(\\\\\n)?)+/ " "
-let eol = del /([ \t]*(\\\\\n)?)*\n/ "\n"
-
-let ws = /[ \t]*/
-let alnum = /[a-zA-Z0-9_]+/
-(* the last character in the non-quoted word must not be a backslash. I guess this is not completely semantically
- correct but at the same time, apache discourages to use backslashes for anything else than
- line breaking so we should be safe here. This restriction is in place to support
- escaped new lines in the sep and eol rules. *)
-let word = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n]*[^'" \t\n\\]/
-let secarg = /\"([^\"\n]|\\\\\")*\"|'([^'\n]|\\\\')*'|[^'" \t\n>]+/
-let wskey (k:regexp) = del ws "" . key k
-let params (param:regexp) = [ sep . label "param" . store param ]*
-let sec (name:string) (body:lens) =
- [ wskey ("<" . name) . params secarg . Util.del_str ">" . eol .
- body . del ws "" . Util.del_str("</" . name . ">") . eol ]
-
-(* Definitions *)
-let comment = [ del /([ \t]*(#.*)*)\n/ "#\n" ]
-let directive = [ wskey alnum . params word . eol ]
-
-let section (name:string) = sec name (directive|comment)*
-
-let sections = section "IfModule"
- | section "Directory"
- | section "DirectoryMatch"
- | section "Files"
- | section "FilesMatch"
- | section "Location"
- | section "LocationMatch"
- | section "AuthnProviderAlias"
- | section "IfDefine"
- | section "IfVersion"
- | section "Limit"
- | section "LimitExcept"
- | section "Proxy"
- | section "ProxyMatch"
-
-let virtualHost = sec "VirtualHost" (directive|comment|sections)*
-
-(* What we want ot say is *)
-(* let rec body = (directive|comment)* | ifModule body | directory body | ... *)
-(* but we can't typecheck that *)
-
-(* FIXME: *)
-(* - Nesting of sections *)
-let lns = (directive | comment | sections | virtualHost)*
-
-let filter =
- incl "/etc/httpd/conf/httpd.conf" .
- Util.stdexcl
-
-let xfm = transform lns filter
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
index b713105..100736c 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/AugeasProxy.java
@@ -57,7 +57,6 @@ public class AugeasProxy {
private Augeas augeas;
private List<String> modules;
private AugeasTreeBuilder augeasTreeBuilder;
-
/**
* Instantiates new proxy with supplied configuration and
@@ -95,7 +94,7 @@ public class AugeasProxy {
* @throws AugeasTreeException
*/
public void load() throws AugeasTreeException {
- config.loadFiles();
+ config.loadFiles();
augeas = new Augeas(config.getRootPath(), config.getLoadPath(), config.getMode());
try {
@@ -110,7 +109,7 @@ public class AugeasProxy {
augeas.set("/augeas/load/" + module.getModuletName() + "/incl[" + (idx++) + "]", incl);
}
- }
+ }
}catch(Exception e){
log.error("Loading of augeas failed",e);
throw new AugeasTreeException(e);
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
index 9fa7a3e..f610726 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensFilter.java
@@ -9,7 +9,7 @@ public class LensFilter implements FileFilter{
private Pattern pattern;
public LensFilter(String name){
- pattern = Pattern.compile(name+".*"+LensHelper.TEMP_FILE_SUFFIX);
+ pattern = Pattern.compile(name+".*");
}
public boolean accept(File pathname) {
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
index a56fb25..7d5cd56 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/LensHelper.java
@@ -1,7 +1,6 @@
package org.rhq.augeas.util;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -16,39 +15,19 @@ public class LensHelper {
String lensPath=null;
if (param.indexOf(File.separatorChar)==-1){
- String tempDir = (String)System.getProperties().get(TEMP_DIRECTORY);
- File tempDirectory = new File(tempDir);
- File [] lens = tempDirectory.listFiles(new LensFilter(param));
- File sourceFile = new File(param);
-
- File tempFile;
-
- if (lens.length==0){
- tempFile = File.createTempFile(param, ".aug");
- tempFile.deleteOnExit();
- copyFile(sourceFile,tempFile);
- }else{
- tempFile = lens[0];
- }
- lensPath = tempFile.getAbsolutePath();
+
}else
lensPath = param;
return lensPath;
}
- private static void copyFile(File source,File destination) throws Exception{
+ public static void copyFile(InputStream in,File destination) throws Exception{
if (!destination.canWrite())
throw new Exception("Creating of temporary file for lens failed. Destination file "
+ destination.getAbsolutePath()+" is not accessible.");
- if (!source.canRead())
- throw new Exception("Creating of temporary file for lens failed. Destination file "
- + destination.getAbsolutePath()+" is not accessible.");
-
-
- InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(destination);
byte[] buf = new byte[1024];
@@ -63,4 +42,41 @@ public class LensHelper {
}
+ public static File createTempDir(String name) throws IOException{
+
+ String tempDir = (String)System.getProperties().get(TEMP_DIRECTORY);
+
+ File tempDirectory = new File(tempDir);
+ File [] lens = tempDirectory.listFiles(new LensFilter(name));
+
+ File lensDirectory;
+
+ if (lens.length==0){
+ File tempFile = File.createTempFile(name, "");
+ String nm = tempFile.getName();
+ tempFile.delete();
+ lensDirectory = new File(tempDirectory,nm);
+ lensDirectory.mkdir();
+ lensDirectory.deleteOnExit();
+ }else{
+ lensDirectory = lens[0];
+ }
+
+ return lensDirectory;
+
+ }
+
+ public static File cpFileFromPluginToTemp(File tempDirectory,String fileName) throws IOException,Exception{
+
+ File destinationFile = new File(tempDirectory,fileName);
+ if (!destinationFile.exists())
+ {
+ destinationFile.createNewFile();
+ InputStream input = tempDirectory.getClass().getClassLoader().getResourceAsStream(fileName);
+ copyFile(input, destinationFile);
+ }
+
+ return destinationFile;
+ }
+
}
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java b/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
index c37cd05..6dc7b7b 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/rhqtransform/impl/PluginDescriptorBasedAugeasConfiguration.java
@@ -36,6 +36,7 @@ import org.apache.commons.logging.LogFactory;
import org.rhq.augeas.config.AugeasConfiguration;
import org.rhq.augeas.config.AugeasModuleConfig;
import org.rhq.augeas.util.Glob;
+import org.rhq.augeas.util.LensHelper;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.rhqtransform.AugeasRhqException;
@@ -78,15 +79,29 @@ public class PluginDescriptorBasedAugeasConfiguration implements AugeasConfigura
modules = new ArrayList<AugeasModuleConfig>();
if (includes.isEmpty())
throw new AugeasRhqException("At least one Include glob must be defined.");
-
+ String augeasModuleName = getAugeasModuleName(pluginConfiguration);
+ File tempDir = null;
+ try {
+ loadPath = pluginConfiguration.getSimpleValue(AUGEAS_LOAD_PATH, "");
+ if (loadPath.equals("")){
+ tempDir = LensHelper.createTempDir(augeasModuleName);
+ loadPath = tempDir.getAbsolutePath();
+ }else{
+ tempDir = new File(loadPath);
+ }
+
AugeasModuleConfig config = new AugeasModuleConfig();
- config.setIncludedGlobs(includes);
- config.setExcludedGlobs(excludes);
- config.setLensPath(getAugeasModuleName(pluginConfiguration) + ".lns");
- config.setModuletName(getAugeasModuleName(pluginConfiguration));
+ config.setIncludedGlobs(includes);
+ config.setExcludedGlobs(excludes);
+ LensHelper.cpFileFromPluginToTemp(tempDir, augeasModuleName+".aug");
+ config.setLensPath(getAugeasModuleName(pluginConfiguration) + ".lns");
+ config.setModuletName(getAugeasModuleName(pluginConfiguration));
modules.add(config);
-
- loadPath = pluginConfiguration.getSimpleValue(AUGEAS_LOAD_PATH, DEFAULT_AUGEAS_LOAD_PATH);
+
+ }catch(Exception e){
+ log.error("Creation of temporary Directory for augeas lens failed.");
+ throw new AugeasRhqException("Creation of temporary Directory for augeas lens failed.",e);
+ }
}
protected List<String> determineGlobs(Configuration configuration, String name) {
diff --git a/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java b/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java
index 6ac7011..b7d11ae 100644
--- a/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java
+++ b/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java
@@ -62,12 +62,12 @@ public class HostsComponentTest extends AbstractAugeasConfigurationComponentTest
defaultPluginConfig.put(new PropertySimple(AugeasConfigurationComponent.INCLUDE_GLOBS_PROP, hostsFilePath));
}
- @BeforeTest
- @Override
- public void resetConfigFiles() throws IOException
- {
- super.resetConfigFiles();
- }
+ // @BeforeTest
+ // @Override
+ // public void resetConfigFiles() throws IOException
+ //{
+ // super.resetConfigFiles();
+ //}
@Override
protected Configuration getExpectedResourceConfig() {
14 years, 3 months
[rhq] modules/core
by mazz
modules/core/plugin-container/pom.xml | 6 +++++-
modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java | 9 +++++----
2 files changed, 10 insertions(+), 5 deletions(-)
New commits:
commit eea8401df5d7d8c508584ae266927e0286c381f1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 20:48:59 2010 -0500
fixed this test so it isn't so brittle - not sure how master has been passing since we moved to 3.0.0
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index 4c39807..f950282 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -150,6 +150,10 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <systemPropertyVariables>
+ <rhq.version>${project.version}</rhq.version>
+ </systemPropertyVariables>
+
<excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
<!-- need to point the library path to the location of the native libraries -->
<argLine>-Dorg.hyperic.sigar.path=${project.build.directory}/jboss-sigar</argLine>
@@ -180,4 +184,4 @@
</repository>
</repositories>
-</project>
\ No newline at end of file
+</project>
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
index a7d27ed..a315276 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/plugin/PluginManagerTest.java
@@ -47,13 +47,14 @@ import java.io.File;
public class PluginManagerTest {
- static final String PLATFORM_PLUGIN = "org/rhq/rhq-platform-plugin/1.4.0-SNAPSHOT/rhq-platform-plugin-1.4.0-SNAPSHOT.jar";
+ static final String VERSION = System.getProperty("rhq.version");
+ static final String PLATFORM_PLUGIN = "org/rhq/rhq-platform-plugin/" + VERSION + "/rhq-platform-plugin-" + VERSION + ".jar";
- static final String HOSTS_PLUGIN = "org/rhq/rhq-hosts-plugin/1.4.0-SNAPSHOT/rhq-hosts-plugin-1.4.0-SNAPSHOT.jar";
+ static final String HOSTS_PLUGIN = "org/rhq/rhq-hosts-plugin/" + VERSION + "/rhq-hosts-plugin-" + VERSION + ".jar";
- static final String AUGEAS_PLUGIN = "org/rhq/rhq-augeas-plugin/1.4.0-SNAPSHOT/rhq-augeas-plugin-1.4.0-SNAPSHOT.jar";
+ static final String AUGEAS_PLUGIN = "org/rhq/rhq-augeas-plugin/" + VERSION + "/rhq-augeas-plugin-" + VERSION + ".jar";
- static final String JMX_PLUGIN = "org/rhq/rhq-jmx-plugin/1.4.0-SNAPSHOT/rhq-jmx-plugin-1.4.0-SNAPSHOT.jar";
+ static final String JMX_PLUGIN = "org/rhq/rhq-jmx-plugin/" + VERSION + "/rhq-jmx-plugin-" + VERSION + ".jar";
String m2RepoDir;
14 years, 3 months
[rhq] Branch 'gwt' - 2 commits - modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java | 18 +++-------
1 file changed, 7 insertions(+), 11 deletions(-)
New commits:
commit 2eccc60e6fd78d25d99ff7746d54c57454ba0982
Merge: 987d9fd... 74cb7e2...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 18:28:48 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index e1b3ac9,73e54a7..d38ea91
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@@ -38,11 -38,11 +38,9 @@@ public class AboutModalWindow extends W
private static final String TITLE = "About RHQ";
public AboutModalWindow() {
-- super();
--
setTitle(TITLE);
setWidth(300);
- setHeight(250);
+ setHeight(240);
setOverflow(Overflow.VISIBLE);
setShowMinimizeButton(false);
setIsModal(true);
@@@ -54,15 -53,16 +52,13 @@@
}
@Override
- protected void onDraw() {
- // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
- // after it's called, otherwise the header bar end up below our content...
- super.onDraw();
+ protected void onInit() {
+ super.onInit();
-
- // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
- // after it's called, otherwise the header bar end up below our content...
-
+
VLayout contentPane = new VLayout();
- contentPane.setMembersMargin(25);
contentPane.setPadding(15);
- contentPane.setAlign(VerticalAlignment.TOP);
-
++ contentPane.setMembersMargin(25);
+
HTMLFlow htmlFlow = new HTMLFlow();
String html =
"<span class=\"DisplaySubhead\">\n" +
@@@ -94,6 -93,8 +89,8 @@@
});
bottomPanel.addMember(closeButton);
-
-
++ // NOTE: Since this is a subclass of Window, we MUST use addItem(), rather than addMember() from the
++ // Layout class.
addItem(contentPane);
}
}
commit 987d9fda73189fef28739d7a543158146a3761d4
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 16:57:21 2010 -0500
fix layout in About box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 21240cf..e1b3ac9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -42,13 +42,14 @@ public class AboutModalWindow extends Window {
setTitle(TITLE);
setWidth(300);
- setHeight(250);
+ setHeight(240);
setOverflow(Overflow.VISIBLE);
setShowMinimizeButton(false);
setIsModal(true);
setShowModalMask(true);
setCanDragResize(false);
setCanDragReposition(false);
+ setAlign(VerticalAlignment.TOP);
centerInPage();
}
@@ -57,11 +58,10 @@ public class AboutModalWindow extends Window {
// NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
// after it's called, otherwise the header bar end up below our content...
super.onDraw();
-
+
VLayout contentPane = new VLayout();
+ contentPane.setMembersMargin(25);
contentPane.setPadding(15);
- contentPane.setAlign(VerticalAlignment.TOP);
- addMember(contentPane);
HTMLFlow htmlFlow = new HTMLFlow();
String html =
@@ -75,6 +75,7 @@ public class AboutModalWindow extends Window {
"</a></p>\n" +
"<div style=\"top-margin: 10px\">All rights reserved.</div>\n";
htmlFlow.setContents(html);
+ htmlFlow.setAutoHeight();
contentPane.addMember(htmlFlow);
HLayout bottomPanel = new HLayout();
@@ -92,5 +93,7 @@ public class AboutModalWindow extends Window {
}
});
bottomPanel.addMember(closeButton);
+
+ addItem(contentPane);
}
}
14 years, 3 months
[rhq] Branch 'bundle' - 2 commits - modules/core modules/enterprise
by Jay Shaughnessy
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 83 ++++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java | 34 ++++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java | 62 +++++++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java | 10 -
5 files changed, 191 insertions(+), 6 deletions(-)
New commits:
commit 091f59945e654da8e2d140cc017d433331b1af7c
Merge: bc2d729... 966bc00...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 17:45:15 2010 -0500
Merge branch 'bundle' into bundle-jay
commit bc2d7299246cc4a83411254c6d2b9a0c04123b28
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 17:43:38 2010 -0500
added:
createBundleDeployDefinition
getBundleVersionFilenames
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
index b83c576..7c88e96 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleDeployDefinition.java
@@ -83,7 +83,7 @@ public class BundleDeployDefinition implements Serializable {
private Long mtime = System.currentTimeMillis();
@JoinColumn(name = "CONFIG_ID", referencedColumnName = "ID", nullable = true)
- @OneToOne(fetch = FetchType.LAZY, optional = true)
+ @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = true)
private Configuration configuration;
@Column(name = "ENFORCE_POLICY", nullable = false)
@@ -107,6 +107,12 @@ public class BundleDeployDefinition implements Serializable {
// for JPA use
}
+ public BundleDeployDefinition(BundleVersion bundleVersion, String name) {
+ this.bundleVersion = bundleVersion;
+ this.name = name;
+ this.enforcePolicy = false;
+ }
+
public int getId() {
return id;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 29b25cf..c9a3261 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -20,8 +20,10 @@ package org.rhq.enterprise.server.bundle;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.util.HashSet;
import java.util.List;
import java.util.Random;
+import java.util.Set;
import java.util.UUID;
import javax.ejb.EJB;
@@ -33,6 +35,7 @@ import javax.persistence.Query;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUtility;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.bundle.Bundle;
@@ -41,6 +44,8 @@ import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
@@ -115,6 +120,44 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
@RequiredPermission(Permission.MANAGE_INVENTORY)
+ public BundleDeployDefinition createBundleDeployDefinition(Subject subject, int bundleVersionId, String name,
+ String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval,
+ boolean pinToBundle) throws Exception {
+
+ if (null == name || "".equals(name.trim())) {
+ throw new IllegalArgumentException("Invalid bundleDeployDefinitionName: " + name);
+ }
+ BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ if (null == bundleVersion) {
+ throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
+ }
+ ConfigurationDefinition configDef = bundleVersion.getConfigurationDefinition();
+ if (null != configDef) {
+ if (null == configuration) {
+ throw new IllegalArgumentException(
+ "Missing Configuration. Configuration is required when the specified BundleVersion defines Configuration Properties.");
+ }
+ List<String> errors = ConfigurationUtility.validateConfiguration(configuration, configDef);
+ if (null != errors && !errors.isEmpty()) {
+ throw new IllegalArgumentException("Invalid Configuration: " + errors.toString());
+ }
+ }
+
+ BundleDeployDefinition deployDef = new BundleDeployDefinition(bundleVersion, name);
+ deployDef.setDescription(description);
+ deployDef.setConfiguration(configuration);
+ deployDef.setEnforcePolicy(enforcePolicy);
+ deployDef.setEnforcementInterval(enforcementInterval);
+ if (pinToBundle) {
+ deployDef.setBundle(bundleVersion.getBundle());
+ }
+
+ entityManager.persist(deployDef);
+
+ return deployDef;
+ }
+
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
public BundleType createBundleType(Subject subject, String name, int resourceTypeId) throws Exception {
if (null == name || "".equals(name.trim())) {
throw new IllegalArgumentException("Invalid bundleTypeName: " + name);
@@ -283,6 +326,46 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
return (PackageType) packageTypeQuery.getSingleResult();
}
+ @RequiredPermission(Permission.MANAGE_INVENTORY)
+ public Set<String> getBundleVersionFilenames(Subject subject, int bundleVersionId, boolean withoutBundleFileOnly)
+ throws Exception {
+
+ BundleVersion bundleVersion = entityManager.find(BundleVersion.class, bundleVersionId);
+ if (null == bundleVersion) {
+ throw new IllegalArgumentException("Invalid bundleVersionId: " + bundleVersionId);
+ }
+
+ // parse the recipe (validation occurs here) and get the config def and list of files
+ BundleType bundleType = bundleVersion.getBundle().getBundleType();
+ BundleServerPluginFacet bp = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
+ .getBundleServerPluginFacet(bundleType.getName());
+ RecipeParseResults parseResults = bp.parseRecipe(bundleVersion.getRecipe());
+
+ Set<String> result = parseResults.getBundleFileNames();
+
+ if (withoutBundleFileOnly) {
+ List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
+ Set<String> allFilenames = result;
+ result = new HashSet<String>(allFilenames.size() - bundleFiles.size());
+ for (String filename : allFilenames) {
+ boolean found = false;
+ for (BundleFile bundleFile : bundleFiles) {
+ String name = bundleFile.getPackageVersion().getGeneralPackage().getName();
+ if (name.equals(filename)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ result.add(filename);
+ }
+ }
+ }
+
+ return result;
+
+ }
+
@SuppressWarnings("unchecked")
public List<BundleType> getAllBundleTypes(Subject subject) {
// the list of types will be small, no need to support paging
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
index ec3b73b..22880be 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerLocal.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.bundle;
import java.io.InputStream;
import java.util.List;
+import java.util.Set;
import javax.ejb.Local;
@@ -30,6 +31,7 @@ import org.rhq.core.domain.bundle.BundleDeployment;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.content.Architecture;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleDeployDefinitionCriteria;
@@ -95,6 +97,24 @@ public interface BundleManagerLocal {
Bundle createBundle(Subject subject, String name, int bundleTypeId) throws Exception;
/**
+ * @param subject must be InventoryManager
+ * @param BundleVersionId the BundleVersion being deployed by this definition
+ * @param name a name for this definition. not null or empty
+ * @param description an optional longer description describing this deploy def
+ * @param configuration a Configuration (pojo) to be associated with this deploy def. Although
+ * it is not enforceable
+ * must be that of the associated BundleVersion.
+ * @param enforcePolicy if true enforce policy on deployments made with this deploy def
+ * @param enforceInterval if enforcePolicy is true check policy at this interval (in seconds), otherwise ignored
+ * @param pinToBundle if true this deploy def is disabled if a newer BundleVersion is generated for the Bundle
+ * @return
+ * @throws Exception
+ */
+ BundleDeployDefinition createBundleDeployDefinition(Subject subject, int bundleVersionId, String name,
+ String description, Configuration configuration, boolean enforcePolicy, int enforcementInterval,
+ boolean pinToBundle) throws Exception;
+
+ /**
* Not generally called. For use by Server Side Plugins when registering a Bundle Plugin.
*
* @param subject must be InventoryManager
@@ -114,6 +134,20 @@ public interface BundleManagerLocal {
BundleVersion createBundleVersion(Subject subject, int bundleId, String name, String bundleVersion, String recipe)
throws Exception;
+ /**
+ * Determine the files required for a BundleVersion and return all of the filenames or optionally, just those
+ * that lack BundleFiles for the BundleVersion. The recipe may be parsed as part of this call.
+ *
+ * @param subject must be InventoryManager
+ * @param bundleVersionId the BundleVersion being queried
+ * @param withoutBundleFileOnly if true omit any filenames that already have a corresponding BundleFile for
+ * the BundleVersion.
+ * @return The List of filenames.
+ * @throws Exception
+ */
+ Set<String> getBundleVersionFilenames(Subject subject, int bundleVersionId, boolean withoutBundleFileOnly)
+ throws Exception;
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// The remaining methods are shared with the Remote Interface.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 24c6dae..45e946f 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.bundle;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -33,9 +34,12 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
@@ -109,6 +113,12 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleFile.class, ((BundleFile) removeMe).getId()));
}
+ // remove any orphaned bdds
+ q = em.createQuery("SELECT bdd FROM BundleDeployDefinition bdd WHERE bdd.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleDeployDefinition.class, ((BundleDeployDefinition) removeMe).getId()));
+ }
// remove packages which cascade remove packageversions
q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
@@ -216,6 +226,47 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
@Test(enabled = TESTS_ENABLED)
+ public void testCreateBundleDeploymentDef() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
+ assertNotNull(bv1);
+ Configuration config = new Configuration();
+ BundleDeployDefinition bdd1;
+ try {
+ bdd1 = createDeployDefinition("one", bv1, config);
+ fail("Bad config was accepted");
+ } catch (Exception e) {
+ System.out.println("EXPECTED EXCEPTION: " + e);
+ // expected due to bad config
+ }
+ config.put(new PropertySimple("bundletest.property", "bundletest.property value"));
+ bdd1 = createDeployDefinition("one", bv1, config);
+ assertNotNull(bdd1);
+ }
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testGetBundleFilenames() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
+ assertNotNull(bv1);
+ Set<String> filenames = bundleManager.getBundleVersionFilenames(getOverlord(), bv1.getId(), true);
+ assertNotNull(filenames);
+ assertEquals(2, filenames.size());
+ BundleFile bf1 = bundleManager.addBundleFileViaByteArray(getOverlord(), bv1.getId(), TEST_PREFIX
+ + "-bundlefile-1", "1.0", null, "Test Bundle File # 1".getBytes(), false);
+ filenames = bundleManager.getBundleVersionFilenames(getOverlord(), bv1.getId(), true);
+ assertNotNull(filenames);
+ assertEquals(1, filenames.size());
+ BundleFile bf2 = bundleManager.addBundleFileViaByteArray(getOverlord(), bv1.getId(), TEST_PREFIX
+ + "-bundlefile-2", "1.0", null, "Test Bundle File # 2".getBytes(), false);
+ filenames = bundleManager.getBundleVersionFilenames(getOverlord(), bv1.getId(), true);
+ assertNotNull(filenames);
+ assertEquals(0, filenames.size());
+ }
+
+ @Test(enabled = TESTS_ENABLED)
public void testfindBundlesByCriteria() throws Exception {
Bundle b1 = createBundle("one");
Bundle b2 = createBundle("two");
@@ -343,6 +394,17 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
return bv;
}
+ private BundleDeployDefinition createDeployDefinition(String name, BundleVersion bv, Configuration config)
+ throws Exception {
+ final String fullName = TEST_PREFIX + "-bundledeploydef-" + name;
+ BundleDeployDefinition bdd = bundleManager.createBundleDeployDefinition(getOverlord(), bv.getId(), fullName,
+ fullName, config, false, -1, false);
+
+ assert bdd.getId() > 0;
+ assert bdd.getName().endsWith(fullName);
+ return bdd;
+ }
+
private ResourceType createResourceType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-resourcetype-" + name;
ResourceType rt = new ResourceType(fullName, "BundleManagerBeanTest", ResourceCategory.PLATFORM, null);
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
index dc43f97..3833955 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
@@ -188,13 +188,13 @@ public class TestBundleServerPluginService extends ServerPluginService implement
ConfigurationDefinition configDef;
Set<String> bundleFileNames;
- configDef = new ConfigurationDefinition("SampleBundle", "Stubbed ConfigDef for Sample Bundle");
- configDef.put(new PropertyDefinitionSimple("sample.bundle.deploy.directory",
- "Stubbed Property for deploy directory (must already exist on target platform)", true,
- PropertySimpleType.STRING));
+ configDef = new ConfigurationDefinition("bundletest-configdef", "Test Config Def for testing BundleVersion");
+ configDef.put(new PropertyDefinitionSimple("bundletest.property",
+ "Test property for BundleVersion Config Def testing", true, PropertySimpleType.STRING));
bundleFileNames = new HashSet<String>();
- bundleFileNames.add("sample-bundle.war");
+ bundleFileNames.add("bundletest-bundlefile-1");
+ bundleFileNames.add("bundletest-bundlefile-2");
return new RecipeParseResults(configDef, bundleFileNames);
}
14 years, 3 months
[rhq] Branch 'gwt' - 2 commits - modules/enterprise
by Greg Hinkle
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java | 12 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 53 ++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 24 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java | 94 +++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 21 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java | 95 ++++++++++
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 4
14 files changed, 301 insertions(+), 28 deletions(-)
New commits:
commit 74cb7e2033597e9cf51fea8e6240c72a89673f6e
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 3 16:53:19 2010 -0500
L&F tweaks
ResouceChildren subtab
Connection settings subtab
user preference access
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 4493de6..4b99b4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -9,7 +9,9 @@
<inherits name='com.smartgwt.SmartGwt' />
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
+<!--
<inherits name="com.smartclient.theme.graphite.Graphite"/>
+-->
<inherits name='ca.nanometrics.gflot.GFlot'/>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
index c522ce2..a206c88 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/BreadcrumbTrailPane.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.gui.coregui.client;
import com.google.gwt.user.client.Window;
+import com.smartgwt.client.types.BkgndRepeat;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.HTMLPane;
@@ -38,6 +39,8 @@ public class BreadcrumbTrailPane extends HTMLPane {
public BreadcrumbTrailPane() {
setHeight(28);
setBackgroundColor("#E6E3E3");
+ setBackgroundImage("[skin]images/ToolStrip/background.png");
+ setBackgroundRepeat(BkgndRepeat.REPEAT_X);
setPadding(5);
setOverflow(Overflow.CLIP_V);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 02ccaee..ab5ecee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -9,6 +9,7 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourcesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.ResourceView;
import org.rhq.enterprise.gui.coregui.client.menu.MenuBarView;
import org.rhq.enterprise.gui.coregui.client.util.ErrorHandler;
+import org.rhq.enterprise.gui.coregui.client.util.preferences.UserPreferences;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
@@ -46,6 +47,8 @@ public class CoreGUI implements EntryPoint {
private static Subject sessionSubject;
//private static Subject fullSubject;
+ private static UserPreferences userPreferences;
+
private static ErrorHandler errorHandler = new ErrorHandler();
private static BreadcrumbTrailPane breadCrumbTrailPane;
@@ -102,6 +105,7 @@ public class CoreGUI implements EntryPoint {
public void onSuccess(Subject result) {
System.out.println("Logged in: " + result.getSessionId());
setSessionSubject(result);
+ userPreferences = new UserPreferences(result);
buildCoreUI();
@@ -236,6 +240,10 @@ public class CoreGUI implements EntryPoint {
return sessionSubject;
}
+ public static UserPreferences getUserPreferences() {
+ return userPreferences;
+ }
+
public static void setSessionSubject(Subject subject) {
GWTServiceLookup.registerSession(String.valueOf(subject.getSessionId()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
index 3f15169..9e5bda6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesView.java
@@ -84,6 +84,7 @@ public class RolesView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
index bf6d742..57ef82c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersView.java
@@ -86,6 +86,7 @@ public class UsersView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
index 21240cf..73e54a7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -53,16 +53,16 @@ public class AboutModalWindow extends Window {
}
@Override
- protected void onDraw() {
+ protected void onInit() {
+ super.onInit();
+
// NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
// after it's called, otherwise the header bar end up below our content...
- super.onDraw();
VLayout contentPane = new VLayout();
contentPane.setPadding(15);
contentPane.setAlign(VerticalAlignment.TOP);
- addMember(contentPane);
-
+
HTMLFlow htmlFlow = new HTMLFlow();
String html =
"<span class=\"DisplaySubhead\">\n" +
@@ -92,5 +92,9 @@ public class AboutModalWindow extends Window {
}
});
bottomPanel.addMember(closeButton);
+
+
+
+ addItem(contentPane);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 2e15b68..204bcfb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -61,6 +61,7 @@ public class SubTabLayout extends VLayout {
buttonBar.setBackgroundColor("grey");
buttonBar.setWidth100();
buttonBar.setBorder(null);
+ buttonBar.setMembersMargin(30);
addMember(buttonBar);
@@ -78,6 +79,7 @@ public class SubTabLayout extends VLayout {
button.setActionType(SelectionType.RADIO);
button.setRadioGroup("subtabs");
button.setBorder(null);
+ button.setAutoFit(true);
button.setBaseStyle("SubTabButton");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 647b072..294bda1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -83,7 +83,14 @@ public class ResourceDatasource extends RPCDataSource {
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
- criteria.addFilterName(this.query);
+
+ if (request.getCriteria().getValues().get("parentId") != null) {
+ criteria.addFilterParentResourceId(Integer.parseInt((String) request.getCriteria().getValues().get("parentId")));
+ }
+
+ if (request.getCriteria().getValues().get("name") != null) {
+ criteria.addFilterName((String) request.getCriteria().getValues().get("name"));
+ }
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 8a6b60f..2857cb0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -68,7 +68,20 @@ public class ResourceSearchView extends VLayout {
private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
+ int parentResourceId;
+
+ /**
+ * A resource list of all resources in the system
+ */
public ResourceSearchView() {
+ this(null);
+ }
+
+ /**
+ * Resource list filtered by a given criteria
+ * @param parentResourceId
+ */
+ public ResourceSearchView(Criteria criteria) {
setWidth100();
setHeight100();
@@ -94,7 +107,11 @@ public class ResourceSearchView extends VLayout {
listGrid.setAutoFetchData(true);
listGrid.setAlternateRecordStyles(true);
// listGrid.setAutoFitData(Autofit.HORIZONTAL);
- listGrid.setCriteria(new Criteria("name", searchPanel.getValueAsString("query")));
+
+ if (criteria != null) {
+ listGrid.setInitialCriteria(criteria);
+ }
+
listGrid.setSelectionType(SelectionStyle.SIMPLE);
listGrid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
listGrid.setResizeFieldsInRealTime(true);
@@ -105,7 +122,7 @@ public class ResourceSearchView extends VLayout {
ListGridField nameField = new ListGridField("name", "Name", 250);
nameField.setCellFormatter(new CellFormatter() {
public String format(Object o, ListGridRecord listGridRecord, int i, int i1) {
- return "<a href=\"#Resource/" + listGridRecord.getAttribute("id") +"\">" + o + "</a>";
+ return "<a href=\"#Resource/" + listGridRecord.getAttribute("id") + "\">" + o + "</a>";
}
});
@@ -116,7 +133,6 @@ public class ResourceSearchView extends VLayout {
ListGridField categoryField = new ListGridField("category", "Category", 60);
-
ListGridField availabilityField = new ListGridField("currentAvailability", "Availability", 55);
availabilityField.setAlign(Alignment.CENTER);
listGrid.setFields(idField, nameField, descriptionField, typeNameField, pluginNameField, categoryField, availabilityField);
@@ -125,6 +141,8 @@ public class ResourceSearchView extends VLayout {
gridHolder.addMember(listGrid);
ToolStrip toolStrip = new ToolStrip();
+ toolStrip.setPadding(5);
+ toolStrip.setWidth100();
toolStrip.setMembersMargin(15);
final IButton removeButton = new IButton("Remove");
@@ -142,8 +160,6 @@ public class ResourceSearchView extends VLayout {
});
-
-
final Label tableInfo = new Label("Total: " + listGrid.getTotalRows());
tableInfo.setWrap(false);
@@ -156,20 +172,19 @@ public class ResourceSearchView extends VLayout {
listGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
- int selectedCount = ((ListGrid)selectionEvent.getSource()).getSelection().length;
+ int selectedCount = ((ListGrid) selectionEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
removeButton.setDisabled(selectedCount == 0);
}
});
-
addMember(gridHolder);
listGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
- int selectedCount = ((ListGrid)dataArrivedEvent.getSource()).getSelection().length;
+ int selectedCount = ((ListGrid) dataArrivedEvent.getSource()).getSelection().length;
tableInfo.setContents("Total: " + listGrid.getTotalRows() + " (" + selectedCount + " selected)");
}
});
@@ -177,9 +192,16 @@ public class ResourceSearchView extends VLayout {
searchBox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
- if (event.getCharacterValue() == KeyCodes.KEY_ENTER) {
+ if ((event.getCharacterValue() != null) && (event.getCharacterValue() == KeyCodes.KEY_ENTER)) {
datasource.setQuery((String) searchBox.getValue());
- Criteria c = new Criteria("name", (String) searchBox.getValue());
+
+ Criteria c = listGrid.getCriteria();
+ if (c == null) {
+ c = new Criteria();
+ }
+
+ c.addCriteria("name",(String) searchBox.getValue());
+
long start = System.currentTimeMillis();
listGrid.fetchData(c);
System.out.println("Loaded in: " + (System.currentTimeMillis() - start));
@@ -193,4 +215,15 @@ public class ResourceSearchView extends VLayout {
selectListeners.add(listener);
}
+
+ // -------- Static Utility loaders ------------
+
+
+ public static ResourceSearchView getChildrenOf(int resourceId) {
+ return new ResourceSearchView(new Criteria("parentId",String.valueOf(resourceId)));
+ }
+
+
+
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 9c6d2ae..e1529ac 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -26,10 +26,12 @@ import org.rhq.enterprise.gui.coregui.client.components.SubTabLayout;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSearchView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectListener;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.layout.VLayout;
@@ -61,7 +63,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
private TwoLevelTabSet topTabSet;
- HTMLFlow title = new HTMLFlow();
+ private ResourceTitleBar titleBar;
public void setResource(Resource resource) {
this.resource = resource;
@@ -88,13 +90,13 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.setEdgeSize(0);
summaryTab = new TwoLevelTab("Summary", "/images/icons/Service_up_16.png");
- summaryTab.registerSubTabs("Overview","Timeline");
+ summaryTab.registerSubTabs("Overview", "Timeline");
monitoringTab = new TwoLevelTab("Monitoring", "/images/icons/Monitor_grey_16.png");
- monitoringTab.registerSubTabs("Graphs","Tables","Traits","Availability","Schedules");
+ monitoringTab.registerSubTabs("Graphs", "Tables", "Traits", "Availability", "Schedules");
inventoryTab = new TwoLevelTab("Inventory", "/images/icons/Inventory_grey_16.png");
- inventoryTab.registerSubTabs("Children","Connection Settings");
+ inventoryTab.registerSubTabs("Children", "Connection Settings");
operationsTab = new TwoLevelTab("Operations", "/images/icons/Operation_grey_16.png");
operationsTab.registerSubTabs("History", "Scheduled");
@@ -111,8 +113,9 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab, eventsTab, contentTab);
- title.setContents("Loading...");
- addMember(title);
+
+ titleBar = new ResourceTitleBar();
+ addMember(titleBar);
addMember(summaryPanel);
@@ -127,8 +130,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
this.summaryView.onResourceSelected(resource);
- title.setContents("<h2>" + resource.getName() + "</h2>");
- title.markForRedraw();
+ titleBar.setResource(resource);
int selectedTab = topTabSet.getSelectedTabNumber();
@@ -145,6 +147,10 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
monitoringTab.updateSubTab("Availability", new FullHTMLPane("/rhq/resource/monitor/availabilityHistory.xhtml?id=" + resource.getId()));
monitoringTab.updateSubTab("Schedules", new FullHTMLPane("/rhq/resource/monitor/schedules.xhtml?id=" + resource.getId()));
+
+ inventoryTab.updateSubTab("Children", ResourceSearchView.getChildrenOf(resource.getId()));
+ inventoryTab.updateSubTab("Connection Settings", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
+
configurationTab.updateSubTab("Current", new ConfigurationEditor(resource.getId(), resource.getResourceType().getId()));
@@ -176,7 +182,7 @@ public class ResourceDetailView extends VLayout implements ResourceSelectListene
topTabSet.enableTab(eventsTab);
}
- if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
+ if (type.getPackageTypes() == null || type.getPackageTypes().isEmpty()) {
topTabSet.disableTab(contentTab);
} else {
topTabSet.enableTab(contentTab);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
new file mode 100644
index 0000000..c67846c
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTitleBar.java
@@ -0,0 +1,94 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.coregui.client.inventory.resource.detail;
+
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+import com.smartgwt.client.types.SelectionType;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.ImgButton;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceTitleBar extends HLayout {
+
+ Resource resource;
+ ImgButton favoriteButton;
+ HTMLFlow title = new HTMLFlow();
+ boolean favorite;
+
+ public static final String FAV_ICON = "Favorite_24_Selected.png";
+ public static final String NOT_FAV_ICON = "Favorite_24.png";
+
+
+ public ResourceTitleBar() {
+ super();
+ setWidth100();
+ setHeight(60);
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ favoriteButton = new ImgButton();
+ favoriteButton.setSrc(NOT_FAV_ICON);
+ favoriteButton.setShowHover(false);
+ favoriteButton.setShowDownIcon(false);
+ favoriteButton.setShowRollOverIcon(false);
+ favoriteButton.setShowFocusedIcon(false);
+
+ favoriteButton.setActionType(SelectionType.CHECKBOX);
+ favoriteButton.setWidth(24);
+ favoriteButton.setHeight(24);
+
+ favoriteButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ favorite = !favorite;
+
+// favoriteButton.setIcon(favorite ? FAV_ICON : NOT_FAV_ICON);
+
+ }
+ });
+
+
+ addMember(title);
+ addMember(favoriteButton);
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+
+ title.setContents("<h2>" + resource.getName() + "</h2>");
+
+ favorite = CoreGUI.getUserPreferences().getFavoriteResources().contains(resource.getId());
+
+ markForRedraw();
+ }
+
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
new file mode 100644
index 0000000..93a7743
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -0,0 +1,95 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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.gui.coregui.client.util.preferences;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author Greg Hinkle
+ */
+public class UserPreferences {
+
+
+ private Subject subject;
+
+ private Configuration userConfiguration;
+
+
+ protected static final String PREF_ITEM_DELIM = "|";
+
+ public static final String PREF_DASH_FAVORITE_RESOURCES = ".dashContent.resourcehealth.resources";
+
+
+ public UserPreferences(Subject subject) {
+ this.subject = subject;
+ subject.getUserConfiguration();
+ }
+
+
+
+
+
+
+
+ public List<Integer> getFavoriteResources() {
+ return getPreferenceAsIntegerList(PREF_DASH_FAVORITE_RESOURCES,PREF_ITEM_DELIM);
+ }
+
+
+
+ protected String getPreference(String name) {
+ return userConfiguration.getSimpleValue(name, null);
+ }
+
+ protected List<String> getPreferenceAsList(String key, String delimiter) {
+ String pref = null;
+ try {
+ pref = getPreference(key);
+ } catch (IllegalArgumentException e) {
+// log.debug("A user preference named '" + key + "' does not exist.");
+ }
+
+ return (pref != null) ? Arrays.asList(pref.split(delimiter)) : new ArrayList<String>();
+ }
+
+ protected List<Integer> getPreferenceAsIntegerList(String key, String delimiter) {
+ try {
+ List<String> value = getPreferenceAsList(key, delimiter);
+
+ List<Integer> result = new ArrayList<Integer>(value.size());
+ for (int i = 0; i < value.size(); i++) {
+ String trimmed = value.get(i).trim();
+ if (trimmed.length() > 0) {
+ result.add(Integer.valueOf(trimmed));
+ }
+ }
+
+ return result;
+ } catch (Exception e) {
+ return new ArrayList<Integer>();
+ }
+ }
+
+
+}
commit c318d414c4d1541b66d27d60ea7a14a81bacc653
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Wed Mar 3 14:06:47 2010 -0500
Experimenting with selenium testing
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
index 525c8b7..58b3a05 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java
@@ -36,7 +36,6 @@ import ca.nanometrics.gflot.client.options.TickFormatter;
import org.rhq.core.domain.measurement.MeasurementConverterClient;
import org.rhq.core.domain.measurement.MeasurementDefinition;
-import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import com.google.gwt.i18n.client.DateTimeFormat;
@@ -45,6 +44,8 @@ import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.WidgetCanvas;
+import com.smartgwt.client.widgets.events.MouseOutEvent;
+import com.smartgwt.client.widgets.events.MouseOutHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import java.util.Date;
@@ -80,8 +81,6 @@ public class SmallGraphView extends VLayout {
setHeight100();
setWidth100();
// setPadding(10);
-
-
}
public String getName() {
@@ -101,6 +100,16 @@ public class SmallGraphView extends VLayout {
@Override
+ protected void onDetach() {
+ super.onDetach(); // TODO: Implement this method.
+ }
+
+ @Override
+ protected void onUnload() {
+ super.onUnload(); // TODO: Implement this method.
+ }
+
+ @Override
public void parentResized() {
super.parentResized();
onDraw();
@@ -159,6 +168,12 @@ public class SmallGraphView extends VLayout {
}
}, false);
+ addMouseOutHandler(new MouseOutHandler() {
+ public void onMouseOut(MouseOutEvent mouseOutEvent) {
+ hoverLabel.animateHide(AnimationEffect.FADE);
+ }
+ });
+
hoverLabel.setOpacity(80);
hoverLabel.setWrap(false);
hoverLabel.setHeight(25);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 5b78843..37fa7dc 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -5,7 +5,9 @@
<link rel="icon" type="image/png" href="/images/favicon.png" />
<link rel="apple-touch-icon" href="/images/favicon.png" />
- <script type="text/javascript">var isomorphicDir = "org.rhq.enterprise.gui.coregui.CoreGUI/sc/";
+ <script type="text/javascript">
+ document.globalObj = window;
+ var isomorphicDir = "org.rhq.enterprise.gui.coregui.CoreGUI/sc/";
</script>
14 years, 3 months
[rhq] Branch 'bundle' - modules/common modules/plugins
by mazz
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/CommandRecipeCommand.java | 56 ++++++++++
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java | 42 +++++++
modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java | 1
modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java | 16 ++
modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java | 19 +++
5 files changed, 132 insertions(+), 2 deletions(-)
New commits:
commit 966bc00b7d6234614635ca5fd319cb57b8a2f12c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 15:49:43 2010 -0500
add shell command recipe support
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/CommandRecipeCommand.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/CommandRecipeCommand.java
new file mode 100644
index 0000000..e5db71d
--- /dev/null
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/CommandRecipeCommand.java
@@ -0,0 +1,56 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.bundle.filetemplate.recipe;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Declares that an existing script or shell command is to be invoked.
+ *
+ * @author John Mazzitelli
+ */
+public class CommandRecipeCommand implements RecipeCommand {
+
+ public String getName() {
+ return "command";
+ }
+
+ public void parse(RecipeParser parser, RecipeContext context, String[] args) {
+
+ if (args == null || args.length == 0) {
+ throw new IllegalArgumentException("Missing the command to execute");
+ }
+
+ String exe = args[0];
+ List<String> exeArgs = new ArrayList<String>(args.length - 1);
+ for (int i = 1; i < args.length; i++) {
+ exeArgs.add(args[i]);
+ }
+
+ context.addCommand(exe, exeArgs);
+
+ return;
+ }
+}
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
index cb76a80..bc8932f 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeContext.java
@@ -48,6 +48,7 @@ public class RecipeContext {
private final Set<String> replacementVariables;
private Configuration replacementVariableValues;
private final List<Script> scripts;
+ private final List<Command> commands;
public RecipeContext(String recipe) {
this.recipe = recipe;
@@ -56,6 +57,7 @@ public class RecipeContext {
this.realizedFiles = new HashSet<String>();
this.replacementVariables = new HashSet<String>();
this.scripts = new ArrayList<Script>();
+ this.commands = new ArrayList<Command>();
}
/**
@@ -190,8 +192,8 @@ public class RecipeContext {
}
class Script {
- private final List<String> args;
private final String exe;
+ private final List<String> args;
public Script(String exe, List<String> args) {
this.exe = exe;
@@ -207,10 +209,38 @@ public class RecipeContext {
}
}
+ /**
+ * Adds a command that the recipe wants invoked. This command refers to an existing
+ * executable or shell command.
+ *
+ * @param cmd the main executable that this command wants to execute
+ * @param exeArgs the arguments to pass to the command executable
+ */
+ public void addCommand(String exe, List<String> exeArgs) {
+ this.commands.add(new Command(exe, exeArgs));
+ }
+
+ class Command {
+ private final String exe;
+ private final List<String> args;
+
+ public Command(String exe, List<String> args) {
+ this.exe = exe;
+ this.args = args;
+ }
+
+ public String getExecutable() {
+ return exe;
+ }
+
+ public List<String> getArguments() {
+ return args;
+ }
+ }
+
@Override
public String toString() {
StringBuilder str = new StringBuilder("RecipeContext:\n");
- str.append("Recipe Text:\n").append(getRecipe()).append("\n");
str.append("Deploy Files: ").append(getDeployFiles()).append("\n");
str.append("Replacement Vars: ").append(getReplacementVariables()).append("\n");
@@ -227,6 +257,14 @@ public class RecipeContext {
for (Script script : this.scripts) {
str.append("* ").append(script.getExecutable()).append(" ").append(script.getArguments()).append("\n");
}
+
+ str.append("Commands: ").append("\n");
+ for (Command cmd : this.commands) {
+ str.append("* ").append(cmd.getExecutable()).append(" ").append(cmd.getArguments()).append("\n");
+ }
+
+ str.append("Recipe Text:\n-----------\n").append(getRecipe()).append("\n");
+
return str.toString();
}
}
diff --git a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
index 98f26f6..f22c04c 100644
--- a/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
+++ b/modules/common/filetemplate-bundle/src/main/java/org/rhq/bundle/filetemplate/recipe/RecipeParser.java
@@ -129,6 +129,7 @@ public class RecipeParser {
HashMap<String, RecipeCommand> commands = new HashMap<String, RecipeCommand>();
RecipeCommand[] knownCommands = new RecipeCommand[] { new ScriptRecipeCommand(), //
+ new CommandRecipeCommand(), //
new FileRecipeCommand(), //
new RealizeRecipeCommand(), //
new DeployRecipeCommand() //
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
index 3682c18..f4cb102 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
@@ -177,6 +177,22 @@ public class ProcessingRecipeContext extends RecipeContext {
}
}
+ @Override
+ public void addCommand(String exe, List<String> exeArgs) {
+ super.addCommand(exe, exeArgs);
+
+ ProcessExecution pe = new ProcessExecution(exe);
+ pe.setArguments(exeArgs);
+ pe.setWaitForCompletion(30 * 60 * 1000L);
+ pe.setCheckExecutableExists(false);
+ pe.setWorkingDirectory(this.baseWorkingDirectory);
+
+ ProcessExecutionResults results = this.systemInfo.executeProcess(pe);
+ if (results.getError() != null) {
+ throw new RuntimeException("Could not execute command [" + pe + "]: " + results, results.getError());
+ }
+ }
+
private void ensureExecutable(File scriptFile) {
boolean success;
diff --git a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
index 47b721f..188e127 100644
--- a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
+++ b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
@@ -40,6 +40,7 @@ import org.rhq.bundle.filetemplate.recipe.RecipeContext;
import org.rhq.bundle.filetemplate.recipe.RecipeParser;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.pluginapi.util.FileUtils;
+import org.rhq.core.system.OperatingSystemType;
import org.rhq.core.system.SystemInfo;
import org.rhq.core.system.SystemInfoFactory;
import org.rhq.core.util.stream.StreamUtil;
@@ -140,6 +141,24 @@ public class ProcessingRecipeContextTest {
assert echoOutputContent.trim().equals("hello");
}
+ public void testCommandRecipe() throws Exception {
+ File testDir = getTestDir("testcommand");
+ File echoOutput = new File(testDir, "out.txt");
+ echoOutput.getParentFile().mkdirs();
+
+ SystemInfo sysinfo = SystemInfoFactory.createSystemInfo();
+ if (sysinfo.getOperatingSystemType() == OperatingSystemType.WINDOWS) {
+ addRecipeCommand("command cmd /C \"echo helloWorld > '" + echoOutput.getAbsolutePath() + "'\"");
+ } else {
+ addRecipeCommand("command sh -c \"echo helloWorld > '" + echoOutput.getAbsolutePath() + "'\"");
+ }
+
+ RecipeContext context = parseRecipeNow(testDir);
+
+ String echoOutputContent = readFile(echoOutput);
+ assert echoOutputContent.trim().equals("helloWorld");
+ }
+
private ProcessingRecipeContext parseRecipeNow(File testDir) throws Exception {
ProcessingRecipeContext context = createRecipeContext(testDir);
return parseRecipeNow(context);
14 years, 3 months
[rhq] Branch 'raw-config' - modules/enterprise
by John Sanda
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java | 58 +++++++---
1 file changed, 41 insertions(+), 17 deletions(-)
New commits:
commit 59e747b964b74af33bab5cc7ac444e903e6b6b2f
Author: John Sanda <john(a)localhost.localdomain>
Date: Wed Mar 3 15:23:18 2010 -0500
Updating the translation/validation logic so that translation still happens
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
index d3907b2..688eb8f 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/configuration/resource/ResourceConfigurationEditor.java
@@ -71,23 +71,46 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
@Override
protected void changeToRawTab() throws ResourceNotFoundException, ConfigurationValidationException {
- resourceConfiguration = translateToRaw();
+ translateToRaw();
+ validateRaw();
+ }
+
+ private void translateToRaw() throws ResourceNotFoundException, ConfigurationValidationException {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ resourceConfiguration = configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
+ resourceConfiguration, STRUCTURED_MODE);
+
for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
RawConfigUIBean uiBean = findRawConfigUIBeanByPath(raw.getPath());
uiBean.setRawConfiguration(raw);
}
}
- private Configuration translateToRaw() throws ResourceNotFoundException, ConfigurationValidationException {
- ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
- return configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
- resourceConfiguration, STRUCTURED_MODE);
+ private void validateRaw() {
+ try {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ configurationMgr.validateResourceConfiguration(loggedInUser.getSubject(), resourceId, resourceConfiguration,
+ false);
+ }
+ catch (ConfigurationValidationException e) {
+ String msg = "Translating the configuration from structured to raw resulted in the following validation " +
+ "errors: " + e.getMessage();
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, msg);
+ copyErrorMessages(e);
+ }
}
@Override
protected void changeToStructuredTab() throws ResourceNotFoundException, ConfigurationValidationException {
+ translateToStructured();
+ validateStructured();
+ }
+
+ private void translateToStructured() throws ResourceNotFoundException, ConfigurationValidationException {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
- resourceConfiguration = translateToStructured();
+ resourceConfiguration = configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
+ resourceConfiguration, RAW_MODE);
for (RawConfiguration raw : resourceConfiguration.getRawConfigurations()) {
RawConfigUIBean uiBean = findRawConfigUIBeanByPath(raw.getPath());
@@ -95,20 +118,21 @@ public class ResourceConfigurationEditor extends ResourceConfigurationViewer imp
if ((raw.errorMessage != null) && (!raw.errorMessage.equals(""))) {
FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, raw.errorMessage);
}
-
}
}
- private Configuration translateToStructured() throws ResourceNotFoundException, ConfigurationValidationException {
- ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
-
- Configuration result = configurationMgr.translateResourceConfiguration(loggedInUser.getSubject(), resourceId,
- resourceConfiguration, RAW_MODE);
-
- configurationMgr.validateResourceConfiguration(loggedInUser.getSubject(), resourceId, result, true);
-
- return result;
-
+ private void validateStructured() {
+ try {
+ ConfigurationManagerLocal configurationMgr = LookupUtil.getConfigurationManager();
+ configurationMgr.validateResourceConfiguration(loggedInUser.getSubject(), resourceId, resourceConfiguration,
+ true);
+ }
+ catch (ConfigurationValidationException e) {
+ String msg = "Translating the configuration from raw to structured resulted in the following validation " +
+ "errors: " + e.getMessage();
+ FacesContextUtility.addMessage(FacesMessage.SEVERITY_ERROR, msg);
+ copyErrorMessages(e);
+ }
}
@Observer("rawConfigUpdate")
14 years, 3 months
[rhq] Branch 'bundle' - modules/core modules/plugins
by mazz
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java | 44 +++
modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java | 120 +++++++++-
modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/FileTemplateBundlePluginServerComponent.java | 88 -------
modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java | 33 ++
modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java | 12 -
5 files changed, 195 insertions(+), 102 deletions(-)
New commits:
commit bd69d0afa634444ad62151d89d3a3f5daf7e4869
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 3 14:29:29 2010 -0500
get the script recipe command to work
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
index 2dd6e6d..741efc3 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
@@ -19,9 +19,12 @@
package org.rhq.core.pluginapi.bundle;
+import java.io.File;
import java.io.Serializable;
+import java.util.Map;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
+import org.rhq.core.domain.content.PackageVersion;
/**
* A request to deploy a bundle.
@@ -31,11 +34,44 @@ import org.rhq.core.domain.bundle.BundleDeployDefinition;
public class BundleDeployRequest implements Serializable {
private static final long serialVersionUID = 1L;
+ private File bundleFilesLocation;
private BundleDeployDefinition bundleDeployDefinition;
- private BundleManagerProvider bundleManager;
+ private BundleManagerProvider bundleManagerProvider;
+ private Map<PackageVersion, File> packageVersionFiles;
+
+ public BundleDeployRequest() {
+ }
+
+ /**
+ * This returns the location where the plugin container has downloaded the bundle files.
+ *
+ * @return the location where the bundle files have been downloaded
+ */
+ public File getBundleFilesLocation() {
+ return this.bundleFilesLocation;
+ }
+
+ public void setBundleFilesLocation(File bundleFilesLocation) {
+ this.bundleFilesLocation = bundleFilesLocation;
+ }
+
+ /**
+ * Maps all the package versions associated with the bundle and the locations
+ * where the package version contents can be found. These will all be located
+ * somewhere under the {@link #getBundleFilesLocation() bundle files location}.
+ *
+ * @return packages and their locations on the local file system
+ */
+ public Map<PackageVersion, File> getPackageVersionFiles() {
+ return this.packageVersionFiles;
+ }
+
+ public void setPackageVersionFiles(Map<PackageVersion, File> packageVersionFiles) {
+ this.packageVersionFiles = packageVersionFiles;
+ }
public BundleDeployDefinition getBundleDeployDefinition() {
- return bundleDeployDefinition;
+ return this.bundleDeployDefinition;
}
public void setBundleDeployDefinition(BundleDeployDefinition bundleDeployDefinition) {
@@ -43,11 +79,11 @@ public class BundleDeployRequest implements Serializable {
}
public BundleManagerProvider getBundleManagerProvider() {
- return bundleManager;
+ return this.bundleManagerProvider;
}
public void setBundleManagerProvider(BundleManagerProvider provider) {
- this.bundleManager = provider;
+ this.bundleManagerProvider = provider;
}
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
index 5db906f..4475be4 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/bundle/BundleManager.java
@@ -22,8 +22,13 @@
*/
package org.rhq.core.pc.bundle;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.OutputStream;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -45,12 +50,14 @@ import org.rhq.core.pc.PluginContainer;
import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.agent.AgentService;
import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.util.ComponentUtil;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.bundle.BundleDeployRequest;
import org.rhq.core.pluginapi.bundle.BundleDeployResult;
import org.rhq.core.pluginapi.bundle.BundleFacet;
import org.rhq.core.pluginapi.bundle.BundleManagerProvider;
+import org.rhq.core.util.MessageDigestGenerator;
/**
* Manages the bundle subsystem, which allows bundles of content to be installed.
@@ -78,15 +85,26 @@ public class BundleManager extends AgentService implements BundleAgentService, B
public void shutdown() {
}
+ public List<PackageVersion> getAllBundleVersionPackageVersions(BundleVersion bundleVersion) throws Exception {
+ int bvId = bundleVersion.getId();
+ List<PackageVersion> pvs = getBundleServerService().getAllBundleVersionPackageVersions(bvId);
+ return pvs;
+ }
+
+ public long getFileContent(PackageVersion packageVersion, OutputStream outputStream) throws Exception {
+ long size = getBundleServerService().downloadPackageBits(packageVersion, outputStream);
+ return size;
+ }
+
public BundleScheduleResponse schedule(BundleScheduleRequest request) {
BundleScheduleResponse response = new BundleScheduleResponse();
try {
- BundleDeployDefinition bundleDef = request.getBundleDeployDefinition();
+ BundleDeployDefinition bundleDeployDef = request.getBundleDeployDefinition();
// find the resource that will handle the bundle processing
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
- BundleType bundleType = bundleDef.getBundleVersion().getBundle().getBundleType();
+ BundleType bundleType = bundleDeployDef.getBundleVersion().getBundle().getBundleType();
ResourceType resourceType = bundleType.getResourceType();
Set<Resource> resources = im.getResourcesWithType(resourceType);
if (resources.isEmpty()) {
@@ -94,6 +112,12 @@ public class BundleManager extends AgentService implements BundleAgentService, B
}
int bundleHandlerResourceId = resources.iterator().next().getId();
+ // pull down the bundle files that the plugin will need in order to process the bundle
+ ResourceContainer resourceContainer = im.getResourceContainer(bundleHandlerResourceId);
+ File pluginTmpDir = resourceContainer.getResourceContext().getTemporaryDirectory();
+ File bundleFilesDir = new File(pluginTmpDir, "" + bundleDeployDef.getBundleVersion().getId());
+ Map<PackageVersion, File> downloadedFiles = downloadBundleFiles(bundleDeployDef, bundleFilesDir);
+
// get the bundle facet object that will process the bundle
int facetMethodTimeout = 4 * 60 * 60 * 1000; // 4 hours is given to the bundle plugin to do its thing
BundleFacet bundlePluginComponent = getBundleFacet(bundleHandlerResourceId, facetMethodTimeout);
@@ -102,6 +126,8 @@ public class BundleManager extends AgentService implements BundleAgentService, B
BundleDeployRequest deployRequest = new BundleDeployRequest();
deployRequest.setBundleManagerProvider(this);
deployRequest.setBundleDeployDefinition(request.getBundleDeployDefinition());
+ deployRequest.setBundleFilesLocation(bundleFilesDir);
+ deployRequest.setPackageVersionFiles(downloadedFiles);
BundleDeployResult result = bundlePluginComponent.deployBundle(deployRequest);
if (!result.isSuccess()) {
response.setErrorMessage(result.getErrorMessage());
@@ -114,15 +140,91 @@ public class BundleManager extends AgentService implements BundleAgentService, B
return response;
}
- public List<PackageVersion> getAllBundleVersionPackageVersions(BundleVersion bundleVersion) throws Exception {
- int bvId = bundleVersion.getId();
- List<PackageVersion> pvs = getBundleServerService().getAllBundleVersionPackageVersions(bvId);
- return pvs;
+ /**
+ * Downloads the bundle's files into the bundle plugin's tmp directory and returns that tmp directory.
+ *
+ * @param bundleDeployDef bundle deployment information, including what bundle files need to be downloaded
+ * @param downloadDir location where the bundle files should be downloaded
+ * @return map of the package versions to their files that were downloaded
+ * @throws Exception
+ */
+ private Map<PackageVersion, File> downloadBundleFiles(BundleDeployDefinition bundleDeployDef, File downloadDir)
+ throws Exception {
+
+ BundleVersion bundleVersion = bundleDeployDef.getBundleVersion();
+
+ // download all the bundle files to the bundle plugin's tmp directory
+ Map<PackageVersion, File> packageVersionFiles = new HashMap<PackageVersion, File>();
+ List<PackageVersion> packageVersions = getAllBundleVersionPackageVersions(bundleVersion);
+ for (PackageVersion packageVersion : packageVersions) {
+ File packageFile = new File(downloadDir, packageVersion.getFileName());
+
+ try {
+ verifyHash(packageVersion, packageFile);
+ } catch (Exception e) {
+ // file either doesn't exist or it hash doesn't match, download a new copy
+ packageFile.getParentFile().mkdirs();
+ FileOutputStream fos = new FileOutputStream(packageFile);
+ try {
+ long size = getFileContent(packageVersion, fos);
+ if (packageVersion.getFileSize() != null && size != packageVersion.getFileSize().longValue()) {
+ log.warn("Downloaded bundle file [" + packageVersion + "] but its size was [" + size
+ + "] when it was expected to be [" + packageVersion.getFileSize() + "].");
+ }
+ } finally {
+ fos.close();
+ }
+
+ // now try to verify it again, if this throws an exception, that is very bad and we need to abort
+ verifyHash(packageVersion, packageFile);
+ }
+
+ packageVersionFiles.put(packageVersion, packageFile);
+ }
+
+ return packageVersionFiles;
}
- public long getFileContent(PackageVersion packageVersion, OutputStream outputStream) throws Exception {
- long size = getBundleServerService().downloadPackageBits(packageVersion, outputStream);
- return size;
+ /**
+ * Checks to see if the package file's hash matches that of the given package version.
+ * If the file doesn't exist or the hash doesn't match, an exception is thrown.
+ * This method returns normally if the hash matches the file.
+ * If there is no known hash in the package version, this method returns normally.
+ *
+ * @param packageVersion contains the hash that is expected
+ * @param packageFile the local file whose hash is to be checked
+ * @throws Exception if the file does not match the hash or the file doesn't exist
+ */
+ private void verifyHash(PackageVersion packageVersion, File packageFile) throws Exception {
+ if (!packageFile.exists()) {
+ throw new Exception("Package version [" + packageVersion + "] does not exist, cannot check hash");
+ }
+
+ if (packageVersion.getMD5() != null) {
+ String realMD5 = MessageDigestGenerator.getDigestString(packageFile);
+ if (!packageVersion.getMD5().equals(realMD5)) {
+ throw new Exception("Package version [" + packageVersion + "] failed MD5 check. expected=["
+ + packageVersion.getMD5() + "], actual=[" + realMD5 + "]");
+ }
+ } else if (packageVersion.getSHA256() != null) {
+ FileInputStream is = new FileInputStream(packageFile);
+ try {
+ MessageDigestGenerator gen = new MessageDigestGenerator("SHA256");
+ gen.add(is);
+ String realSHA256 = gen.getDigestString();
+ if (!packageVersion.getSHA256().equals(realSHA256)) {
+ throw new Exception("Package version [" + packageVersion + "] failed SHA256 check. expected=["
+ + packageVersion.getSHA256() + "], actual=[" + realSHA256 + "]");
+ }
+ } finally {
+ is.close();
+ }
+
+ } else {
+ log.debug("Package version [" + packageVersion + "] has no MD5/SHA256 hash - not verifying it");
+ }
+
+ return;
}
/**
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/FileTemplateBundlePluginServerComponent.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/FileTemplateBundlePluginServerComponent.java
index cee69db..9536665 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/FileTemplateBundlePluginServerComponent.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/FileTemplateBundlePluginServerComponent.java
@@ -18,28 +18,18 @@
*/
package org.rhq.plugins.filetemplate;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rhq.bundle.filetemplate.recipe.RecipeParser;
import org.rhq.core.domain.bundle.BundleDeployDefinition;
import org.rhq.core.domain.bundle.BundleVersion;
-import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.bundle.BundleDeployRequest;
import org.rhq.core.pluginapi.bundle.BundleDeployResult;
import org.rhq.core.pluginapi.bundle.BundleFacet;
-import org.rhq.core.pluginapi.bundle.BundleManagerProvider;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.util.MessageDigestGenerator;
/**
* @author John Mazzitelli
@@ -68,42 +58,12 @@ public class FileTemplateBundlePluginServerComponent implements ResourceComponen
BundleDeployDefinition bundleDeployDef = request.getBundleDeployDefinition();
BundleVersion bundleVersion = bundleDeployDef.getBundleVersion();
- // download all the bundle files to our tmp directory
- Map<PackageVersion, File> packageVersionFiles = new HashMap<PackageVersion, File>();
- File tmpDir = new File(this.resourceContext.getTemporaryDirectory(), "" + bundleVersion.getId());
- BundleManagerProvider bundleManager = request.getBundleManagerProvider();
- List<PackageVersion> packageVersions = bundleManager.getAllBundleVersionPackageVersions(bundleVersion);
- for (PackageVersion packageVersion : packageVersions) {
- File packageFile = new File(tmpDir, packageVersion.getFileName());
-
- try {
- verifyHash(packageVersion, packageFile);
- } catch (Exception e) {
- // file either doesn't exist or it hash doesn't match, download a new copy
- packageFile.getParentFile().mkdirs();
- FileOutputStream fos = new FileOutputStream(packageFile);
- try {
- long size = bundleManager.getFileContent(packageVersion, fos);
- if (packageVersion.getFileSize() != null && size != packageVersion.getFileSize().longValue()) {
- log.warn("Downloaded bundle file [" + packageVersion + "] but its size was [" + size
- + "] when it was expected to be [" + packageVersion.getFileSize() + "].");
- }
- } finally {
- fos.close();
- }
-
- // now try to verify it again, if this throws an exception, that is very bad and we need to abort
- verifyHash(packageVersion, packageFile);
- }
-
- packageVersionFiles.put(packageVersion, packageFile);
- }
-
// process the recipe
String recipe = bundleVersion.getRecipe();
RecipeParser parser = new RecipeParser();
- ProcessingRecipeContext recipeContext = new ProcessingRecipeContext(recipe, packageVersionFiles,
- this.resourceContext.getSystemInformation(), tmpDir.getAbsolutePath());
+ ProcessingRecipeContext recipeContext = new ProcessingRecipeContext(recipe, request
+ .getPackageVersionFiles(), this.resourceContext.getSystemInformation(), request
+ .getBundleFilesLocation().getAbsolutePath());
recipeContext.setReplacementVariableValues(bundleDeployDef.getConfiguration());
parser.setReplaceReplacementVariables(true);
parser.parseRecipe(recipeContext);
@@ -114,46 +74,4 @@ public class FileTemplateBundlePluginServerComponent implements ResourceComponen
}
return result;
}
-
- /**
- * Checks to see if the package file's hash matches that of the given package version.
- * If the file doesn't exist or the hash doesn't match, an exception is thrown.
- * This method returns normally if the hash matches the file.
- * If there is no known hash in the package version, this method returns normally.
- *
- * @param packageVersion contains the hash that is expected
- * @param packageFile the local file whose hash is to be checked
- * @throws Exception if the file does not match the hash or the file doesn't exist
- */
- private void verifyHash(PackageVersion packageVersion, File packageFile) throws Exception {
- if (!packageFile.exists()) {
- throw new Exception("Package version [" + packageVersion + "] does not exist, cannot check hash");
- }
-
- if (packageVersion.getMD5() != null) {
- String realMD5 = MessageDigestGenerator.getDigestString(packageFile);
- if (!packageVersion.getMD5().equals(realMD5)) {
- throw new Exception("Package version [" + packageVersion + "] failed MD5 check. expected=["
- + packageVersion.getMD5() + "], actual=[" + realMD5 + "]");
- }
- } else if (packageVersion.getSHA256() != null) {
- FileInputStream is = new FileInputStream(packageFile);
- try {
- MessageDigestGenerator gen = new MessageDigestGenerator("SHA256");
- gen.add(is);
- String realSHA256 = gen.getDigestString();
- if (!packageVersion.getSHA256().equals(realSHA256)) {
- throw new Exception("Package version [" + packageVersion + "] failed SHA256 check. expected=["
- + packageVersion.getSHA256() + "], actual=[" + realSHA256 + "]");
- }
- } finally {
- is.close();
- }
-
- } else {
- log.debug("Package version [" + packageVersion + "] has no MD5/SHA256 hash - not verifying it");
- }
-
- return;
- }
}
diff --git a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
index 26199d3..3682c18 100644
--- a/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
+++ b/modules/plugins/filetemplate-bundle/src/main/java/org/rhq/plugins/filetemplate/ProcessingRecipeContext.java
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -31,6 +32,7 @@ import java.util.Set;
import org.rhq.bundle.filetemplate.recipe.RecipeContext;
import org.rhq.bundle.filetemplate.recipe.RecipeParser;
import org.rhq.core.domain.content.PackageVersion;
+import org.rhq.core.system.OperatingSystemType;
import org.rhq.core.system.ProcessExecution;
import org.rhq.core.system.ProcessExecutionResults;
import org.rhq.core.system.SystemInfo;
@@ -162,6 +164,8 @@ public class ProcessingRecipeContext extends RecipeContext {
File scriptFile = new File(this.baseWorkingDirectory, exe);
+ ensureExecutable(scriptFile);
+
ProcessExecution pe = new ProcessExecution(scriptFile.getAbsolutePath());
pe.setArguments(exeArgs);
pe.setWaitForCompletion(30 * 60 * 1000L);
@@ -173,6 +177,35 @@ public class ProcessingRecipeContext extends RecipeContext {
}
}
+ private void ensureExecutable(File scriptFile) {
+ boolean success;
+
+ try {
+ Method m = File.class.getMethod("setExecutable", Boolean.TYPE, Boolean.TYPE);
+ Boolean r = (Boolean) m.invoke(scriptFile, Boolean.TRUE, Boolean.TRUE);
+ success = r.booleanValue();
+ } catch (Exception e) {
+ // Oh, if only we'd just stop dilly-dallying and move to JDK6 already
+ if (this.systemInfo.getOperatingSystemType() != OperatingSystemType.WINDOWS) {
+ ProcessExecution pe = new ProcessExecution("chmod");
+ pe.setArguments(new String[] { "u+x", scriptFile.getAbsolutePath() });
+ pe.setWaitForCompletion(30000L);
+ pe.setCheckExecutableExists(false);
+ pe.setWorkingDirectory(scriptFile.getParent());
+ ProcessExecutionResults chmodResults = this.systemInfo.executeProcess(pe);
+ success = (chmodResults.getExitCode() != null && chmodResults.getExitCode().intValue() == 0);
+ } else {
+ success = true; // assume we can execute it on windows
+ }
+ }
+
+ if (!success) {
+ throw new RuntimeException("Cannot ensure that script [" + scriptFile + "] is executable");
+ }
+
+ return;
+ }
+
private ProcessExecution getUnzipExecution(File file, String directory) {
String exe;
List<String> args = null;
diff --git a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
index 1099481..47b721f 100644
--- a/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
+++ b/modules/plugins/filetemplate-bundle/src/test/java/org/rhq/plugins/filetemplate/ProcessingRecipeContextTest.java
@@ -122,18 +122,22 @@ public class ProcessingRecipeContextTest {
assert zippedFileContent.equals("zipped file content");
}
- @Test(enabled = false)
public void testScriptRecipe() throws Exception {
File testDir = getTestDir("testscript");
+ File testOutDir = getTestDir("testscript-out");
+ File echoOutput = new File(testOutDir, "out.txt");
+ echoOutput.getParentFile().mkdirs();
+ File script = writeFile("echo hello > \"" + echoOutput.getAbsolutePath() + "\"\n", testDir, "bin/test.sh");
- addRecipeCommand("script echo hello");
+ addRecipeCommand("script bin/test.sh");
RecipeContext context = parseRecipeNow(testDir);
Set<String> scripts = context.getScriptFiles();
assert scripts.size() == 1 : scripts;
- assert scripts.contains("run-me.sh") : scripts;
- assert scripts.contains("lots-o-params.sh") : scripts;
+ assert scripts.contains("bin/test.sh") : scripts;
+ String echoOutputContent = readFile(echoOutput);
+ assert echoOutputContent.trim().equals("hello");
}
private ProcessingRecipeContext parseRecipeNow(File testDir) throws Exception {
14 years, 3 months
[rhq] Branch 'gwt' - 4 commits - modules/enterprise
by ips
modules/enterprise/gui/coregui/pom.xml | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 46 ++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java | 96 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java | 35 +--
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css | 15 +
modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml | 17 +
8 files changed, 176 insertions(+), 47 deletions(-)
New commits:
commit 1fa0487a463841eb06b64cf226cd6ef338b14699
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 13:22:30 2010 -0500
upgrade SmartGWT from 2.0 to 2.1; switch to Graphite SmartGWT skin; fix a couple bugs in AdministrationView
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index f248a15..b0f49c3 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -66,8 +66,15 @@
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>com.smartgwt</groupId>
+ <artifactId>smartgwt-skins</artifactId>
+ <version>2.1</version>
</dependency>
+ -->
<!-- The graphing library -->
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 080f9b2..4493de6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -9,7 +9,10 @@
<inherits name='com.smartgwt.SmartGwt' />
<inherits name="com.smartgwt.tools.SmartGwtTools"/>
+ <inherits name="com.smartclient.theme.graphite.Graphite"/>
+
<inherits name='ca.nanometrics.gflot.GFlot'/>
+
<!--
<inherits name='com.google.gwt.widgetideas.WidgetIdeas'/>
-->
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index 1e4e517..c1c321e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -28,11 +28,9 @@ import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import com.smartgwt.client.types.ContentsType;
import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.HTMLPane;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -125,13 +123,18 @@ public class AdministrationView extends HLayout implements ViewRenderer {
securityTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
+ Canvas content;
if (selectionEvent.getRecord() == manageUsersNode) {
- setContent(new UsersView());
+ content = new UsersView();
} else if (selectionEvent.getRecord() == manageRolesNode) {
- setContent(new RolesView());
+ content = new RolesView();
} else if (selectionEvent.getRecord() == manageGroups) {
- setContent(new RolesView());
+ content = new RolesView();
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
+ setContent(content);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != securityTreeGrid) {
treeGrid.deselectAllRecords();
@@ -171,12 +174,7 @@ public class AdministrationView extends HLayout implements ViewRenderer {
mgmtClusterTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
- String url = null;
+ String url;
if (selectionEvent.getRecord() == manageServersNode) {
url = "/rhq/ha/listServers.xhtml";
} else if (selectionEvent.getRecord() == manageAgentsNode) {
@@ -185,9 +183,13 @@ public class AdministrationView extends HLayout implements ViewRenderer {
url = "/rhq/ha/listAffinityGroups.xhtml";
} else if (selectionEvent.getRecord() == managePartitionEventsNode) {
url = "/rhq/ha/listPartitionEvents.xhtml";
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- pane.setContentsURL(url + "?nomenu=true");
+ url = addQueryStringParam(url, "nomenu=true");
+ FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != mgmtClusterTreeGrid) {
treeGrid.deselectAllRecords();
@@ -221,17 +223,16 @@ public class AdministrationView extends HLayout implements ViewRenderer {
pluginsTreeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- HTMLPane pane = new HTMLPane();
- pane.setContentsType(ContentsType.PAGE);
- pane.setWidth100();
- pane.setHeight100();
-
String url = null;
if (selectionEvent.getRecord() == managePlugins) {
url = "/rhq/admin/plugin/plugin-list.xhtml";
+ } else {
+ throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- pane.setContentsURL(url + "?nomenu=true");
+ url = addQueryStringParam(url, "nomenu=true");
+ FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != pluginsTreeGrid) {
treeGrid.deselectAllRecords();
@@ -282,10 +283,10 @@ public class AdministrationView extends HLayout implements ViewRenderer {
} else {
throw new IllegalStateException("Unknown record selected: " + selectionEvent.getRecord());
}
- url += "&nomenu=true";
-
+ url = addQueryStringParam(url, "nomenu=true");
FullHTMLPane pane = new FullHTMLPane(url);
setContent(pane);
+
for (TreeGrid treeGrid : treeGrids) {
if (treeGrid != systemConfigTreeGrid) {
treeGrid.deselectAllRecords();
@@ -362,4 +363,9 @@ public class AdministrationView extends HLayout implements ViewRenderer {
}
throw new UnknownViewException();
}
+
+ private static String addQueryStringParam(String url, String param) {
+ char separatorChar = (url.indexOf('?') == -1) ? '?' : '&';
+ return url + separatorChar + param;
+ }
}
commit 1b17bb43d3a34ee9233a55222e2b8e9a6b642c2d
Merge: e7db48a... 013f7b7...
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 08:42:46 2010 -0500
Merge branch 'gwt' of ssh://git.fedorahosted.org/git/rhq/rhq into gwt
commit e7db48aeb91b95d7ecc8f03ba84ed04509b1fb9d
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Wed Mar 3 08:42:31 2010 -0500
add About box
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
new file mode 100644
index 0000000..21240cf
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/AboutModalWindow.java
@@ -0,0 +1,96 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2010 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.gui.coregui.client.components;
+
+import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * The "About RHQ" modal window.
+ *
+ * @author Ian Springer
+ */
+public class AboutModalWindow extends Window {
+ private static final String TITLE = "About RHQ";
+
+ public AboutModalWindow() {
+ super();
+
+ setTitle(TITLE);
+ setWidth(300);
+ setHeight(250);
+ setOverflow(Overflow.VISIBLE);
+ setShowMinimizeButton(false);
+ setIsModal(true);
+ setShowModalMask(true);
+ setCanDragResize(false);
+ setCanDragReposition(false);
+ centerInPage();
+ }
+
+ @Override
+ protected void onDraw() {
+ // NOTE: super.onDraw() is what will add the header bar to the Window, so we have to add our own content
+ // after it's called, otherwise the header bar end up below our content...
+ super.onDraw();
+
+ VLayout contentPane = new VLayout();
+ contentPane.setPadding(15);
+ contentPane.setAlign(VerticalAlignment.TOP);
+ addMember(contentPane);
+
+ HTMLFlow htmlFlow = new HTMLFlow();
+ String html =
+ "<span class=\"DisplaySubhead\">\n" +
+ " <a href=\"http://rhq-project.org/\" title=\"RHQ Homepage\" target=\"_blank\">RHQ</a>\n" +
+ "</span><br/>\n" +
+ "<span class=\"DisplayLabel\">Version: 3.0.0-SNAPSHOT</span><br/>\n" +
+ "<span class=\"DisplayLabel\">Build Number: 0</span>\n" +
+ "<p><a href=\"http://jboss.org/\" title=\"JBoss Homepage\">\n" +
+ " <img height=\"55\" alt=\"JBoss by Red Hat\" src=\"/images/jboss_logo.png\">\n" +
+ "</a></p>\n" +
+ "<div style=\"top-margin: 10px\">All rights reserved.</div>\n";
+ htmlFlow.setContents(html);
+ contentPane.addMember(htmlFlow);
+
+ HLayout bottomPanel = new HLayout();
+ contentPane.addMember(bottomPanel);
+ Canvas spacer = new Canvas();
+ spacer.setWidth("*");
+ bottomPanel.addMember(spacer);
+ Button closeButton = new Button("Close");
+ closeButton.setShowRollOver(true);
+ closeButton.setShowDown(true);
+ closeButton.setWidth("60");
+ closeButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ hide();
+ }
+ });
+ bottomPanel.addMember(closeButton);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
index 90dcac4..b09fac8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/MenuBarView.java
@@ -18,28 +18,14 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.DemoCanvas;
-import org.rhq.enterprise.gui.coregui.client.admin.AdministrationView;
-
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
-import com.google.gwt.user.client.ui.Widget;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.WidgetCanvas;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.LinkItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuBar;
-import com.smartgwt.client.widgets.menu.MenuItem;
+import org.rhq.enterprise.gui.coregui.client.components.AboutModalWindow;
import java.util.LinkedHashMap;
@@ -50,11 +36,11 @@ public class MenuBarView extends HLayout {
MenuBar menuBar;
-
LinkedHashMap<String, Menu> menus = new LinkedHashMap<String, Menu>();
- public MenuBarView() {
+ private AboutModalWindow aboutModalWindow;
+ public MenuBarView() {
setHeight(30);
setAlign(VerticalAlignment.BOTTOM);
setAlign(Alignment.LEFT);
@@ -68,7 +54,6 @@ public class MenuBarView extends HLayout {
icon.addItem(new MenuItem("Dashboard"));
menuBar.addMenus(new Menu[]{icon},0);
-
Menu overview = new Menu();
overview.setTitle("Applications");
overview.addItem(new MenuItem("Content Configuration"));
@@ -76,7 +61,6 @@ public class MenuBarView extends HLayout {
overview.addItem(new MenuItem("Administration"));
menuBar.addMenus(new Menu[]{overview},1);
-
Menu views = new Menu();
views.setTitle("Views");
views.addItem(new MenuItem("Problems"));
@@ -85,11 +69,8 @@ public class MenuBarView extends HLayout {
views.addItem(new MenuItem("Recent Administration"));
menuBar.addMenus(new Menu[]{views},2);
-
menuBar.setWidth100();
-
-
addChild(menuBar);
setWidth100();*/
}
@@ -101,7 +82,13 @@ public class MenuBarView extends HLayout {
setMembersMargin(20);
+ this.aboutModalWindow = new AboutModalWindow();
Img logo = new Img("RHQ.png", 100, 35);
+ logo.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
+ MenuBarView.this.aboutModalWindow.show();
+ }
+ });
addMember(logo);
Hyperlink dashboardLink = new Hyperlink("Dashboard", "Dashboard");
@@ -120,14 +107,12 @@ public class MenuBarView extends HLayout {
Hyperlink bundlesLink = new Hyperlink("Bundles", "Bundles");
bundlesLink.setStylePrimaryName("TopSectionLink");
addMember(bundlesLink);
-
Hyperlink adminLink = new Hyperlink("Administration", "Administration");
adminLink.setStylePrimaryName("TopSectionLink");
addMember(adminLink);
-
-
+
//
// LinkItem demoLink = new LinkItem("Demo");
// demoLink.setShowTitle(false);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
index 4391f58..c873d70 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.css
@@ -133,6 +133,21 @@ a:hover {
}
+/* About Modal Window */
+.DisplayContent,.DisplayLabel {
+ font-size: 11px;
+}
+
+.DisplayLabel {
+ font-weight: bold;
+}
+
+.DisplaySubhead {
+ font-weight: bolder;
+ font-size: 16px;
+ color: #DE652D;
+}
+
.SubTabButton,
.SubTabButtonOver,
commit 604dd8ff69c821d192c447af81c7f6f3deb0a8e8
Author: Ian P. Springer <ips(a)jetengine.(none)>
Date: Tue Mar 2 14:29:41 2010 -0500
use History.newItem(path) rather than History.newItem(path, true), since, when in prod mode, the latter appears to not call the history even listener as it should; add menu items in portal-war Overview menu that link to the new GWT GUI
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 468dcea..956b01b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -259,7 +259,7 @@ public class CoreGUI implements EntryPoint {
}
public static void goTo(String path) {
- History.newItem(path, true);
+ History.newItem(path);
}
public static void updateBreadCrumbDisplayName(ViewId viewId, String displayName) {
diff --git a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
index 06c665b..07ea8e6 100644
--- a/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/perspectives/core/perspective/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -92,6 +92,23 @@
placement="after" />
</menu-item>
+ <menu-item
+ name="overview.gwtGui"
+ displayName="GWT GUI"
+ url="/coregui/CoreGUI.html#Resources">
+ <position
+ name="overview.dashboard"
+ placement="after" />
+ </menu-item>
+ <menu-item
+ name="overview.gwtGuiDevMode"
+ displayName="GWT GUI - Dev Mode"
+ url="/coregui/CoreGUI.html?gwt.codesvr=127.0.0.1:9997#Resources">
+ <position
+ name="overview.gwtGui"
+ placement="after" />
+ </menu-item>
+
<!-- Core Menu: Resources -->
<menu-item
name="resources.platforms"
14 years, 3 months
[rhq] Branch 'bundle' - 9 commits - etc/eclipse-tools modules/core modules/enterprise
by Jay Shaughnessy
etc/eclipse-tools/RHQ | 38 +-
modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java | 16 -
modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java | 17 -
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java | 139 +++++++---
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java | 33 ++
6 files changed, 173 insertions(+), 78 deletions(-)
New commits:
commit 062ce6a3fdeb4613a5c8e5dfb654d6b314718b10
Merge: 3a9c7df... 1dd05b6...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:38:10 2010 -0500
Merge branch 'bundle' into bundle-jay
commit 3a9c7dfc0edc71be7c00f67db4d65737e5de3614
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:37:58 2010 -0500
git forced commit
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - Test.launch b/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
index 821c398..e4e88fc 100644
--- a/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
+++ b/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/rhq"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
-<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
-<mapEntry key="port" value="8797"/>
-<mapEntry key="hostname" value="localhost"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/rhq"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
+<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
+<mapEntry key="port" value="8797"/>
+<mapEntry key="hostname" value="localhost"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
+</launchConfiguration>
commit 1dd05b6d50a662d89c6aaf62c5e68a060df2bf5d
Merge: 95178af... f7bb4c6...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:30:56 2010 -0500
Merge branch 'bundle' of ssh://git.fedorahosted.org/git/rhq/rhq into bundle
commit 95178af531e8185e90062e7122908ed4cc7f6597
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:30:03 2010 -0500
git forced LT commit
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - Test.launch b/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
index 821c398..e4e88fc 100644
--- a/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
+++ b/etc/eclipse-tools/RHQ Remote Debugging - Test.launch
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/rhq"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
-<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
-<mapEntry key="port" value="8797"/>
-<mapEntry key="hostname" value="localhost"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/rhq"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
+<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
+<mapEntry key="port" value="8797"/>
+<mapEntry key="hostname" value="localhost"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
+</launchConfiguration>
commit 7104751dfca528c2cd03fefb4ad78427c2919220
Merge: a310714... 845e3c0...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:29:38 2010 -0500
Merge branch 'bundle-jay' into bundle
commit 845e3c0f4782ff87ca0ecdc9d1d252841b3b5fe1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:29:25 2010 -0500
checkin of stable code
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
index dfd1b45..fcc7389 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
@@ -52,7 +52,7 @@ import org.rhq.core.domain.content.PackageVersion;
@NamedQuery(name = BundleFile.QUERY_FIND_ALL, query = "SELECT bf FROM BundleFile bf"), //
@NamedQuery(name = BundleFile.QUERY_FIND_BY_BUNDLE_VERSION_ID, query = "SELECT bf FROM BundleFile bf WHERE bf.bundleVersion.id = :id") //
})
-@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_CONFIG_ID_SEQ")
+@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_FILE_ID_SEQ")
@Table(name = "RHQ_BUNDLE_FILE")
@XmlAccessorType(XmlAccessType.FIELD)
public class BundleFile implements Serializable {
@@ -72,7 +72,7 @@ public class BundleFile implements Serializable {
@JoinColumn(name = "PACKAGE_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne(fetch = FetchType.LAZY)
- private Package pkg;
+ private Package generalPackage;
@JoinColumn(name = "PACKAGE_VERSION_ID", referencedColumnName = "ID", nullable = false)
@ManyToOne(fetch = FetchType.LAZY)
@@ -99,11 +99,11 @@ public class BundleFile implements Serializable {
}
public Package getPackage() {
- return pkg;
+ return generalPackage;
}
public void setPackage(Package pkg) {
- this.pkg = pkg;
+ this.generalPackage = pkg;
}
public PackageVersion getPackageVersion() {
@@ -124,7 +124,7 @@ public class BundleFile implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((bundleVersion == null) ? 0 : bundleVersion.hashCode());
- result = prime * result + ((pkg == null) ? 0 : pkg.hashCode());
+ result = prime * result + ((generalPackage == null) ? 0 : generalPackage.hashCode());
result = prime * result + ((packageVersion == null) ? 0 : packageVersion.hashCode());
return result;
}
@@ -148,11 +148,11 @@ public class BundleFile implements Serializable {
return false;
}
- if (pkg == null) {
- if (other.pkg != null) {
+ if (generalPackage == null) {
+ if (other.generalPackage != null) {
return false;
}
- } else if (!pkg.equals(other.pkg)) {
+ } else if (!generalPackage.equals(other.generalPackage)) {
return false;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index f4582d0..69e8175 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -188,7 +188,7 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "GROUP BY rt.name " //
+ " HAVING COUNT(rt.name) > 1"), //
@NamedQuery(name = ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN, query = "" //
- + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' || rt.name FROM ResourceType rt" ) //
+ + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' || rt.name FROM ResourceType rt") //
})
@NamedNativeQueries( {
// TODO: Add authz conditions to the below query.
@@ -236,14 +236,14 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category = ? " +
// "ORDER BY crt2.name" +
")) ORDER BY name", resultSetMapping = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY) //
- })
+})
@SqlResultSetMapping(name = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY, entities = { @EntityResult(entityClass = ResourceType.class) })
// @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class ResourceType implements Externalizable, Comparable<ResourceType> {
private static final long serialVersionUID = 2L;
public static final String TABLE_NAME = "RHQ_RESOURCE_TYPE";
-
+
public static final ResourceType ANY_PLATFORM_TYPE = null;
public static final String QUERY_FIND_BY_NAME = "ResourceType.findByName";
@@ -379,7 +379,7 @@ public class ResourceType implements Externalizable, Comparable<ResourceType> {
@OneToMany(mappedBy = "resourceType", cascade = CascadeType.ALL)
private Set<ProductVersion> productVersions;
- @OneToOne(mappedBy = "resourceType", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE }, optional = true)
+ @OneToOne(mappedBy = "resourceType", fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = true)
private BundleType bundleType;
@Transient
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
index ba53759..d9b77af 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
@@ -19,12 +19,9 @@
package org.rhq.enterprise.server.bundle;
-import java.util.HashSet;
import java.util.Set;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.configuration.definition.PropertySimpleType;
/**
* This class is general to all Bundle handling server side plugins. It is returned by the SSP when parsing
@@ -46,14 +43,6 @@ public class RecipeParseResults {
}
public ConfigurationDefinition getConfigDef() {
-
- // stub out a test ConfigDef here until we actual parse the recipe
- System.out.println("!!!!!! REMOVE THIS TEST CODE !!!!!!!!");
- configDef = new ConfigurationDefinition("SampleBundle", "Stubbed ConfigDef for Sample Bundle");
- configDef.put(new PropertyDefinitionSimple("sample.bundle.deploy.directory",
- "Stubbed Property for deploy directory (must already exist on target platform)", true,
- PropertySimpleType.STRING));
-
return configDef;
}
@@ -62,12 +51,6 @@ public class RecipeParseResults {
}
public Set<String> getBundleFileNames() {
- // stub out a test set of BundleFiles here until we actual parse the recipe. For now lets just deploy
- // a war file into an existing app server dir.
- System.out.println("!!!!!! REMOVE THIS TEST CODE !!!!!!!!");
- bundleFileNames = new HashSet<String>();
- bundleFileNames.add("sample-bundle.war");
-
return bundleFileNames;
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 1ca01c8..24c6dae 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -36,7 +36,9 @@ import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
@@ -54,9 +56,9 @@ import org.rhq.enterprise.server.util.LookupUtil;
@Test
public class BundleManagerBeanTest extends AbstractEJB3Test {
- private static final String TEST_PREFIX = "bundletest";
+ private static final boolean TESTS_ENABLED = true;
- private static final boolean ENABLED = true;
+ private static final String TEST_PREFIX = "bundletest";
private BundleManagerLocal bundleManager;
@@ -65,7 +67,8 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
@BeforeMethod
public void beforeMethod() {
- super.startTest();
+ // try and clean up any junk that may be lying around from a failed run
+ cleanupDatabase();
this.ps = new TestBundleServerPluginService();
prepareCustomServerPluginService(this.ps);
@@ -76,6 +79,13 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
@AfterMethod(alwaysRun = true)
public void afterMethod() throws Exception {
+ cleanupDatabase();
+
+ unprepareServerPluginService();
+ this.ps = null;
+ }
+
+ private void cleanupDatabase() {
EntityManager em = null;
try {
@@ -86,42 +96,63 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
List doomed;
// clean up any tests that don't already clean up after themselves
- q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.bundle.name LIKE '" + TEST_PREFIX + "%'");
+
+ // remove bundleversions which cascade remove bundlefiles and bundledeploydefs
+ q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleVersion.class, ((BundleVersion) removeMe).getId()));
}
-
+ // remove any orphaned bfs
+ q = em.createQuery("SELECT bf FROM BundleFile bf WHERE bf.generalPackage.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleFile.class, ((BundleFile) removeMe).getId()));
+ }
+ // remove packages which cascade remove packageversions
+ q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ }
+ // remove any orphaned pvs
+ q = em.createQuery("SELECT pv FROM PackageVersion pv WHERE pv.generalPackage.name LIKE '" + TEST_PREFIX
+ + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(PackageVersion.class, ((PackageVersion) removeMe).getId()));
+ }
+ // remove bundles which cascade remove repos
q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
}
-
+ // remove any orphaned repos
q = em.createQuery("SELECT r FROM Repo r WHERE r.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Repo.class, ((Repo) removeMe).getId()));
}
-
+ // remove ResourceTypes which cascade remove BundleTypes and PackageTypes
+ q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(ResourceType.class, ((ResourceType) removeMe).getId()));
+ }
+ // remove any orphaned BundleTypes
q = em.createQuery("SELECT bt FROM BundleType bt WHERE bt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleType.class, ((BundleType) removeMe).getId()));
}
-
+ // remove any orphaned packagetypes
q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
}
- q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(ResourceType.class, ((ResourceType) removeMe).getId()));
- }
-
getTransactionManager().commit();
em.close();
em = null;
@@ -136,14 +167,9 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
em.close();
}
}
-
- unprepareServerPluginService();
- this.ps = null;
-
- super.endTest();
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testGetBundleTypes() throws Exception {
BundleType bt1 = createBundleType("one");
BundleType bt2 = createBundleType("two");
@@ -159,13 +185,13 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assert btNames.contains(bt2.getName());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundle() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundleVersion() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
@@ -177,7 +203,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals("1.1", bv2.getVersion());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testAddBundleFiles() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
@@ -189,7 +215,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
+ "-bundlefile-2", "1.0", null, "Test Bundle File # 2".getBytes(), false);
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testfindBundlesByCriteria() throws Exception {
Bundle b1 = createBundle("one");
Bundle b2 = createBundle("two");
@@ -246,7 +272,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals(b.getName(), r.getName());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testfindBundleVersionsByCriteria() throws Exception {
Bundle b1 = createBundle("one");
BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
@@ -331,7 +357,8 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
private PackageType createPackageType(String name, ResourceType rt) throws Exception {
- final String fullName = TEST_PREFIX + "-packagetype-" + name;
+ // the package type is named the same as the bundle type
+ final String fullName = TEST_PREFIX + "-type-" + name;
PackageType pt = new PackageType(fullName, rt);
TransactionManager txMgr = getTransactionManager();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
index 64bd5af..dc43f97 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
@@ -22,11 +22,15 @@ import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.plugin.PluginKey;
import org.rhq.core.domain.plugin.PluginStatusType;
import org.rhq.core.domain.plugin.ServerPlugin;
@@ -40,6 +44,7 @@ import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
import org.rhq.enterprise.server.plugin.pc.ServerPluginService;
import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginFacet;
import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginManager;
import org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorMetadataParser;
import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
@@ -165,5 +170,33 @@ public class TestBundleServerPluginService extends ServerPluginService implement
components.put(environment.getPluginKey().getPluginName(), component);
return component;
}
+
+ @Override
+ public BundleServerPluginFacet getBundleServerPluginFacet(String bundleTypeName) {
+
+ return new TestBundlePluginComponent();
+ }
+ }
+
+ class TestBundlePluginComponent implements BundleServerPluginFacet {
+
+ public TestBundlePluginComponent() {
+ };
+
+ public RecipeParseResults parseRecipe(String recipe) throws Exception {
+
+ ConfigurationDefinition configDef;
+ Set<String> bundleFileNames;
+
+ configDef = new ConfigurationDefinition("SampleBundle", "Stubbed ConfigDef for Sample Bundle");
+ configDef.put(new PropertyDefinitionSimple("sample.bundle.deploy.directory",
+ "Stubbed Property for deploy directory (must already exist on target platform)", true,
+ PropertySimpleType.STRING));
+
+ bundleFileNames = new HashSet<String>();
+ bundleFileNames.add("sample-bundle.war");
+
+ return new RecipeParseResults(configDef, bundleFileNames);
+ }
}
}
\ No newline at end of file
commit a310714100956e5a1c6cd9fb452f5c94cdba35d5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 3 12:23:11 2010 -0500
Back to steady state - tests passing
notable changes:
- fixed sequence decl for BundleFile and changed pkg field to generalPackage for consistency
- took out test stub code from RecipeParseResults
- added test impl of BundleServerPluginFacet
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
index dfd1b45..fcc7389 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/bundle/BundleFile.java
@@ -52,7 +52,7 @@ import org.rhq.core.domain.content.PackageVersion;
@NamedQuery(name = BundleFile.QUERY_FIND_ALL, query = "SELECT bf FROM BundleFile bf"), //
@NamedQuery(name = BundleFile.QUERY_FIND_BY_BUNDLE_VERSION_ID, query = "SELECT bf FROM BundleFile bf WHERE bf.bundleVersion.id = :id") //
})
-@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_CONFIG_ID_SEQ")
+@SequenceGenerator(name = "SEQ", sequenceName = "RHQ_BUNDLE_FILE_ID_SEQ")
@Table(name = "RHQ_BUNDLE_FILE")
@XmlAccessorType(XmlAccessType.FIELD)
public class BundleFile implements Serializable {
@@ -72,7 +72,7 @@ public class BundleFile implements Serializable {
@JoinColumn(name = "PACKAGE_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne(fetch = FetchType.LAZY)
- private Package pkg;
+ private Package generalPackage;
@JoinColumn(name = "PACKAGE_VERSION_ID", referencedColumnName = "ID", nullable = false)
@ManyToOne(fetch = FetchType.LAZY)
@@ -99,11 +99,11 @@ public class BundleFile implements Serializable {
}
public Package getPackage() {
- return pkg;
+ return generalPackage;
}
public void setPackage(Package pkg) {
- this.pkg = pkg;
+ this.generalPackage = pkg;
}
public PackageVersion getPackageVersion() {
@@ -124,7 +124,7 @@ public class BundleFile implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((bundleVersion == null) ? 0 : bundleVersion.hashCode());
- result = prime * result + ((pkg == null) ? 0 : pkg.hashCode());
+ result = prime * result + ((generalPackage == null) ? 0 : generalPackage.hashCode());
result = prime * result + ((packageVersion == null) ? 0 : packageVersion.hashCode());
return result;
}
@@ -148,11 +148,11 @@ public class BundleFile implements Serializable {
return false;
}
- if (pkg == null) {
- if (other.pkg != null) {
+ if (generalPackage == null) {
+ if (other.generalPackage != null) {
return false;
}
- } else if (!pkg.equals(other.pkg)) {
+ } else if (!generalPackage.equals(other.generalPackage)) {
return false;
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
index f4582d0..69e8175 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/ResourceType.java
@@ -188,7 +188,7 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "GROUP BY rt.name " //
+ " HAVING COUNT(rt.name) > 1"), //
@NamedQuery(name = ResourceType.QUERY_DYNAMIC_CONFIG_WITH_PLUGIN, query = "" //
- + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' || rt.name FROM ResourceType rt" ) //
+ + "SELECT rt.plugin || ' - ' || rt.name, rt.plugin || '-' || rt.name FROM ResourceType rt") //
})
@NamedNativeQueries( {
// TODO: Add authz conditions to the below query.
@@ -236,14 +236,14 @@ import org.rhq.core.domain.util.serial.ExternalizableStrategy;
+ "WHERE rtp2.resource_type_id = crt2.id) " + "AND crt2.category = ? " +
// "ORDER BY crt2.name" +
")) ORDER BY name", resultSetMapping = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY) //
- })
+})
@SqlResultSetMapping(name = ResourceType.MAPPING_FIND_CHILDREN_BY_CATEGORY, entities = { @EntityResult(entityClass = ResourceType.class) })
// @Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class ResourceType implements Externalizable, Comparable<ResourceType> {
private static final long serialVersionUID = 2L;
public static final String TABLE_NAME = "RHQ_RESOURCE_TYPE";
-
+
public static final ResourceType ANY_PLATFORM_TYPE = null;
public static final String QUERY_FIND_BY_NAME = "ResourceType.findByName";
@@ -379,7 +379,7 @@ public class ResourceType implements Externalizable, Comparable<ResourceType> {
@OneToMany(mappedBy = "resourceType", cascade = CascadeType.ALL)
private Set<ProductVersion> productVersions;
- @OneToOne(mappedBy = "resourceType", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE }, optional = true)
+ @OneToOne(mappedBy = "resourceType", fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = true)
private BundleType bundleType;
@Transient
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
index ba53759..d9b77af 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/RecipeParseResults.java
@@ -19,12 +19,9 @@
package org.rhq.enterprise.server.bundle;
-import java.util.HashSet;
import java.util.Set;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
-import org.rhq.core.domain.configuration.definition.PropertySimpleType;
/**
* This class is general to all Bundle handling server side plugins. It is returned by the SSP when parsing
@@ -46,14 +43,6 @@ public class RecipeParseResults {
}
public ConfigurationDefinition getConfigDef() {
-
- // stub out a test ConfigDef here until we actual parse the recipe
- System.out.println("!!!!!! REMOVE THIS TEST CODE !!!!!!!!");
- configDef = new ConfigurationDefinition("SampleBundle", "Stubbed ConfigDef for Sample Bundle");
- configDef.put(new PropertyDefinitionSimple("sample.bundle.deploy.directory",
- "Stubbed Property for deploy directory (must already exist on target platform)", true,
- PropertySimpleType.STRING));
-
return configDef;
}
@@ -62,12 +51,6 @@ public class RecipeParseResults {
}
public Set<String> getBundleFileNames() {
- // stub out a test set of BundleFiles here until we actual parse the recipe. For now lets just deploy
- // a war file into an existing app server dir.
- System.out.println("!!!!!! REMOVE THIS TEST CODE !!!!!!!!");
- bundleFileNames = new HashSet<String>();
- bundleFileNames.add("sample-bundle.war");
-
return bundleFileNames;
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 1ca01c8..24c6dae 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -36,7 +36,9 @@ import org.rhq.core.domain.bundle.Bundle;
import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.content.Package;
import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
@@ -54,9 +56,9 @@ import org.rhq.enterprise.server.util.LookupUtil;
@Test
public class BundleManagerBeanTest extends AbstractEJB3Test {
- private static final String TEST_PREFIX = "bundletest";
+ private static final boolean TESTS_ENABLED = true;
- private static final boolean ENABLED = true;
+ private static final String TEST_PREFIX = "bundletest";
private BundleManagerLocal bundleManager;
@@ -65,7 +67,8 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
@BeforeMethod
public void beforeMethod() {
- super.startTest();
+ // try and clean up any junk that may be lying around from a failed run
+ cleanupDatabase();
this.ps = new TestBundleServerPluginService();
prepareCustomServerPluginService(this.ps);
@@ -76,6 +79,13 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
@AfterMethod(alwaysRun = true)
public void afterMethod() throws Exception {
+ cleanupDatabase();
+
+ unprepareServerPluginService();
+ this.ps = null;
+ }
+
+ private void cleanupDatabase() {
EntityManager em = null;
try {
@@ -86,42 +96,63 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
List doomed;
// clean up any tests that don't already clean up after themselves
- q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.bundle.name LIKE '" + TEST_PREFIX + "%'");
+
+ // remove bundleversions which cascade remove bundlefiles and bundledeploydefs
+ q = em.createQuery("SELECT bv FROM BundleVersion bv WHERE bv.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleVersion.class, ((BundleVersion) removeMe).getId()));
}
-
+ // remove any orphaned bfs
+ q = em.createQuery("SELECT bf FROM BundleFile bf WHERE bf.generalPackage.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(BundleFile.class, ((BundleFile) removeMe).getId()));
+ }
+ // remove packages which cascade remove packageversions
+ q = em.createQuery("SELECT p FROM Package p WHERE p.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(Package.class, ((Package) removeMe).getId()));
+ }
+ // remove any orphaned pvs
+ q = em.createQuery("SELECT pv FROM PackageVersion pv WHERE pv.generalPackage.name LIKE '" + TEST_PREFIX
+ + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(PackageVersion.class, ((PackageVersion) removeMe).getId()));
+ }
+ // remove bundles which cascade remove repos
q = em.createQuery("SELECT b FROM Bundle b WHERE b.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Bundle.class, ((Bundle) removeMe).getId()));
}
-
+ // remove any orphaned repos
q = em.createQuery("SELECT r FROM Repo r WHERE r.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(Repo.class, ((Repo) removeMe).getId()));
}
-
+ // remove ResourceTypes which cascade remove BundleTypes and PackageTypes
+ q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(ResourceType.class, ((ResourceType) removeMe).getId()));
+ }
+ // remove any orphaned BundleTypes
q = em.createQuery("SELECT bt FROM BundleType bt WHERE bt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(BundleType.class, ((BundleType) removeMe).getId()));
}
-
+ // remove any orphaned packagetypes
q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
}
- q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
- doomed = q.getResultList();
- for (Object removeMe : doomed) {
- em.remove(em.getReference(ResourceType.class, ((ResourceType) removeMe).getId()));
- }
-
getTransactionManager().commit();
em.close();
em = null;
@@ -136,14 +167,9 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
em.close();
}
}
-
- unprepareServerPluginService();
- this.ps = null;
-
- super.endTest();
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testGetBundleTypes() throws Exception {
BundleType bt1 = createBundleType("one");
BundleType bt2 = createBundleType("two");
@@ -159,13 +185,13 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assert btNames.contains(bt2.getName());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundle() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testCreateBundleVersion() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
@@ -177,7 +203,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals("1.1", bv2.getVersion());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testAddBundleFiles() throws Exception {
Bundle b1 = createBundle("one");
assertNotNull(b1);
@@ -189,7 +215,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
+ "-bundlefile-2", "1.0", null, "Test Bundle File # 2".getBytes(), false);
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testfindBundlesByCriteria() throws Exception {
Bundle b1 = createBundle("one");
Bundle b2 = createBundle("two");
@@ -246,7 +272,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals(b.getName(), r.getName());
}
- @Test(enabled = ENABLED)
+ @Test(enabled = TESTS_ENABLED)
public void testfindBundleVersionsByCriteria() throws Exception {
Bundle b1 = createBundle("one");
BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
@@ -331,7 +357,8 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
private PackageType createPackageType(String name, ResourceType rt) throws Exception {
- final String fullName = TEST_PREFIX + "-packagetype-" + name;
+ // the package type is named the same as the bundle type
+ final String fullName = TEST_PREFIX + "-type-" + name;
PackageType pt = new PackageType(fullName, rt);
TransactionManager txMgr = getTransactionManager();
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
index 64bd5af..dc43f97 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
@@ -22,11 +22,15 @@ import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.plugin.PluginKey;
import org.rhq.core.domain.plugin.PluginStatusType;
import org.rhq.core.domain.plugin.ServerPlugin;
@@ -40,6 +44,7 @@ import org.rhq.enterprise.server.plugin.pc.ServerPluginManager;
import org.rhq.enterprise.server.plugin.pc.ServerPluginService;
import org.rhq.enterprise.server.plugin.pc.ServerPluginType;
import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginFacet;
import org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginManager;
import org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorMetadataParser;
import org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
@@ -165,5 +170,33 @@ public class TestBundleServerPluginService extends ServerPluginService implement
components.put(environment.getPluginKey().getPluginName(), component);
return component;
}
+
+ @Override
+ public BundleServerPluginFacet getBundleServerPluginFacet(String bundleTypeName) {
+
+ return new TestBundlePluginComponent();
+ }
+ }
+
+ class TestBundlePluginComponent implements BundleServerPluginFacet {
+
+ public TestBundlePluginComponent() {
+ };
+
+ public RecipeParseResults parseRecipe(String recipe) throws Exception {
+
+ ConfigurationDefinition configDef;
+ Set<String> bundleFileNames;
+
+ configDef = new ConfigurationDefinition("SampleBundle", "Stubbed ConfigDef for Sample Bundle");
+ configDef.put(new PropertyDefinitionSimple("sample.bundle.deploy.directory",
+ "Stubbed Property for deploy directory (must already exist on target platform)", true,
+ PropertySimpleType.STRING));
+
+ bundleFileNames = new HashSet<String>();
+ bundleFileNames.add("sample-bundle.war");
+
+ return new RecipeParseResults(configDef, bundleFileNames);
+ }
}
}
\ No newline at end of file
commit 870834d52077aebf478fc8c4eb420d095756d2e9
Merge: 3c61acc... f6fd9c9...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 2 16:11:25 2010 -0500
Merge branch 'bundle-jay' into bundle
Conflicts:
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
diff --cc modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index a7cf52d,9e56e1e..1ca01c8
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@@ -65,10 -67,14 +67,10 @@@ public class BundleManagerBeanTest exte
public void beforeMethod() {
super.startTest();
- if (null == ps) {
- ps = new TestBundleServerPluginService();
- pc = ps.createMasterPluginContainer();
- } else {
- pc.initialize(ps.masterConfig);
- }
-
+ this.ps = new TestBundleServerPluginService();
+ prepareCustomServerPluginService(this.ps);
- bundleManagerBean = LookupUtil.getBundleManager();
+ bundleManager = LookupUtil.getBundleManager();
+ this.ps.startMasterPluginContainer();
}
@AfterMethod(alwaysRun = true)
commit f6fd9c9a4684c2eec48ee16fe4923d50203d8a80
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 2 16:06:42 2010 -0500
added a few more tests
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index e8ac546..9e56e1e 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -33,8 +33,10 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.bundle.Bundle;
+import org.rhq.core.domain.bundle.BundleFile;
import org.rhq.core.domain.bundle.BundleType;
import org.rhq.core.domain.bundle.BundleVersion;
+import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.criteria.BundleVersionCriteria;
@@ -56,7 +58,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
private static final boolean ENABLED = true;
- private BundleManagerLocal bundleManagerBean;
+ private BundleManagerLocal bundleManager;
private TestBundleServerPluginService ps;
private MasterServerPluginContainer pc;
@@ -72,7 +74,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
pc.initialize(ps.masterConfig);
}
- bundleManagerBean = LookupUtil.getBundleManager();
+ bundleManager = LookupUtil.getBundleManager();
}
@AfterMethod(alwaysRun = true)
@@ -112,6 +114,12 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
em.remove(em.getReference(BundleType.class, ((BundleType) removeMe).getId()));
}
+ q = em.createQuery("SELECT pt FROM PackageType pt WHERE pt.name LIKE '" + TEST_PREFIX + "%'");
+ doomed = q.getResultList();
+ for (Object removeMe : doomed) {
+ em.remove(em.getReference(PackageType.class, ((PackageType) removeMe).getId()));
+ }
+
q = em.createQuery("SELECT rt FROM ResourceType rt WHERE rt.name LIKE '" + TEST_PREFIX + "%'");
doomed = q.getResultList();
for (Object removeMe : doomed) {
@@ -144,7 +152,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
public void testGetBundleTypes() throws Exception {
BundleType bt1 = createBundleType("one");
BundleType bt2 = createBundleType("two");
- List<BundleType> bts = bundleManagerBean.getAllBundleTypes(LookupUtil.getSubjectManager().getOverlord());
+ List<BundleType> bts = bundleManager.getAllBundleTypes(LookupUtil.getSubjectManager().getOverlord());
assert bts.size() >= 2 : "should have at least 2 bundle types";
List<String> btNames = new ArrayList<String>();
@@ -157,6 +165,36 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLED)
+ public void testCreateBundle() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ }
+
+ @Test(enabled = ENABLED)
+ public void testCreateBundleVersion() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
+ assertNotNull(bv1);
+ assertEquals("1.0", bv1.getVersion());
+ BundleVersion bv2 = createBundleVersion(b1.getName() + "-2", null, b1);
+ assertNotNull(bv2);
+ assertEquals("1.1", bv2.getVersion());
+ }
+
+ @Test(enabled = ENABLED)
+ public void testAddBundleFiles() throws Exception {
+ Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
+ assertNotNull(bv1);
+ BundleFile bf1 = bundleManager.addBundleFileViaByteArray(getOverlord(), bv1.getId(), TEST_PREFIX
+ + "-bundlefile-1", "1.0", null, "Test Bundle File # 1".getBytes(), false);
+ BundleFile bf2 = bundleManager.addBundleFileViaByteArray(getOverlord(), bv1.getId(), TEST_PREFIX
+ + "-bundlefile-2", "1.0", null, "Test Bundle File # 2".getBytes(), false);
+ }
+
+ @Test(enabled = ENABLED)
public void testfindBundlesByCriteria() throws Exception {
Bundle b1 = createBundle("one");
Bundle b2 = createBundle("two");
@@ -168,7 +206,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
String name = null;
// return all with no optional data
- bundles = bundleManagerBean.findBundlesByCriteria(getOverlord(), c);
+ bundles = bundleManager.findBundlesByCriteria(getOverlord(), c);
assertNotNull(bundles);
assertEquals(2, bundles.size());
b = bundles.get(0);
@@ -197,7 +235,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
c.addFilterBundleTypeName(b.getName());
c.fetchBundleVersions(true);
c.fetchRepo(true);
- bundles = bundleManagerBean.findBundlesByCriteria(getOverlord(), c);
+ bundles = bundleManager.findBundlesByCriteria(getOverlord(), c);
assertNotNull(bundles);
assertEquals(1, bundles.size());
b = bundles.get(0);
@@ -224,7 +262,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
BundleVersion bv = null;
// return all with no optional data
- bvs = bundleManagerBean.findBundleVersionsByCriteria(getOverlord(), c);
+ bvs = bundleManager.findBundleVersionsByCriteria(getOverlord(), c);
bv = bvs.get(1);
assertNotNull(bvs);
assertEquals(3, bvs.size());
@@ -238,7 +276,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
c.fetchBundle(true);
c.fetchDistribution(true);
c.fetchBundleDeployDefinitions(true);
- bvs = bundleManagerBean.findBundleVersionsByCriteria(getOverlord(), c);
+ bvs = bundleManager.findBundleVersionsByCriteria(getOverlord(), c);
assertNotNull(bvs);
assertEquals(1, bvs.size());
bv = bvs.get(0);
@@ -251,7 +289,9 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
private BundleType createBundleType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-type-" + name;
- BundleType bt = bundleManagerBean.createBundleType(getOverlord(), fullName, createResourceType(name).getId());
+ ResourceType rt = createResourceType(name);
+ PackageType pt = createPackageType(name, rt);
+ BundleType bt = bundleManager.createBundleType(getOverlord(), fullName, rt.getId());
assert bt.getId() > 0;
assert bt.getName().endsWith(fullName);
@@ -265,7 +305,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
private Bundle createBundle(String name, BundleType bt) throws Exception {
final String fullName = TEST_PREFIX + "-bundle-" + name;
- Bundle b = bundleManagerBean.createBundle(getOverlord(), fullName, bt.getId());
+ Bundle b = bundleManager.createBundle(getOverlord(), fullName, bt.getId());
assert b.getId() > 0;
assert b.getName().endsWith(fullName);
@@ -273,10 +313,9 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
private BundleVersion createBundleVersion(String name, String version, Bundle bundle) throws Exception {
- final String fullName = TEST_PREFIX + "-version-" + version + "-" + name;
+ final String fullName = TEST_PREFIX + "-bundleversion-" + version + "-" + name;
final String recipe = "deploy -f " + TEST_PREFIX + ".zip -d <% test.path %>";
- BundleVersion bv = bundleManagerBean.createBundleVersion(getOverlord(), bundle.getId(), fullName, version,
- recipe);
+ BundleVersion bv = bundleManager.createBundleVersion(getOverlord(), bundle.getId(), fullName, version, recipe);
assert bv.getId() > 0;
assert bv.getName().endsWith(fullName);
@@ -296,6 +335,19 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
return rt;
}
+ private PackageType createPackageType(String name, ResourceType rt) throws Exception {
+ final String fullName = TEST_PREFIX + "-packagetype-" + name;
+ PackageType pt = new PackageType(fullName, rt);
+
+ TransactionManager txMgr = getTransactionManager();
+ txMgr.begin();
+ EntityManager em = getEntityManager();
+ em.persist(pt);
+ em.close();
+ txMgr.commit();
+ return pt;
+ }
+
private Subject getOverlord() {
return LookupUtil.getSubjectManager().getOverlord();
}
14 years, 3 months